mirror of
https://github.com/wassname/flask-security.git
synced 2026-09-10 12:01:01 +08:00
First code commit
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
{%- with messages = get_flashed_messages(with_categories=true) -%}
|
||||
{% if messages %}
|
||||
<ul class=flashes>
|
||||
{% for category, message in messages %}
|
||||
<li class="{{ category }}">{{ message }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
{%- endwith %}
|
||||
@@ -0,0 +1,20 @@
|
||||
{%- if current_user.is_authenticated() -%}
|
||||
<p>Hello {{ current_user.email }}</p>
|
||||
{%- endif %}
|
||||
<ul>
|
||||
<li><a href="{{ url_for('index') }}">Index</a></li>
|
||||
<li><a href="{{ url_for('profile') }}">Profile</a></li>
|
||||
{% if current_user.has_role('admin') -%}
|
||||
<li><a href="{{ url_for('admin') }}">Admin</a></li>
|
||||
{% endif -%}
|
||||
{% if current_user.has_role('admin') or current_user.has_role('editor') -%}
|
||||
<li><a href="{{ url_for('admin_or_editor') }}">Admin or Editor</a></li>
|
||||
{% endif -%}
|
||||
<li>
|
||||
{%- if current_user.is_authenticated() -%}
|
||||
<a href="{{ url_for('auth.logout') }}">Log out</a>
|
||||
{%- else -%}
|
||||
<a href="{{ url_for('login') }}">Log in</a>
|
||||
{%- endif -%}
|
||||
</li>
|
||||
</ul>
|
||||
@@ -0,0 +1,3 @@
|
||||
{% include "_messages.html" %}
|
||||
{% include "_nav.html" %}
|
||||
<p>{{ content }}</p>
|
||||
@@ -0,0 +1,10 @@
|
||||
{% include "_messages.html" %}
|
||||
{% include "_nav.html" %}
|
||||
<form action="{{ url_for('auth.authenticate') }}" method="POST" name="login_form">
|
||||
{{ form.hidden_tag() }}
|
||||
{{ form.username.label }} {{ form.username }}<br/>
|
||||
{{ form.password.label }} {{ form.password }}<br/>
|
||||
{{ form.remember.label }} {{ form.remember }}<br/>
|
||||
{{ form.submit }}
|
||||
</form>
|
||||
<p>{{ content }}</p>
|
||||
Reference in New Issue
Block a user