mirror of
https://github.com/wassname/flask-security.git
synced 2026-07-17 01:30:35 +08:00
Update default login template and add security state to app context processory
This commit is contained in:
@@ -1,11 +0,0 @@
|
||||
{% include "_messages.html" %}
|
||||
{% include "_nav.html" %}
|
||||
<form action="{{ url_for_security('authenticate') }}" method="POST" name="login_form">
|
||||
{{ form.hidden_tag() }}
|
||||
{{ form.email.label }} {{ form.email }}<br/>
|
||||
{{ form.password.label }} {{ form.password }}<br/>
|
||||
{{ form.remember.label }} {{ form.remember }}<br/>
|
||||
{{ form.next }}
|
||||
{{ form.submit }}
|
||||
</form>
|
||||
<p>{{ content }}</p>
|
||||
@@ -256,12 +256,13 @@ class Security(object):
|
||||
template_folder='templates')
|
||||
app.register_blueprint(bp)
|
||||
|
||||
app.context_processor(lambda: dict(url_for_security=url_for_security))
|
||||
|
||||
state = self._get_state(app, datastore or self.datastore)
|
||||
|
||||
app.extensions['security'] = state
|
||||
|
||||
app.context_processor(lambda: dict(url_for_security=url_for_security,
|
||||
security=state))
|
||||
|
||||
return state
|
||||
|
||||
def _get_state(self, app, datastore):
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{% from "security/_macros.html" import render_field_with_errors, render_field %}
|
||||
{% include "security/_messages.html" %}
|
||||
<h1>Send reset password instructions</h1>
|
||||
<h1>Send password reset instructions</h1>
|
||||
<form action="{{ url_for_security('forgot_password') }}" method="POST" name="forgot_password_form">
|
||||
{{ forgot_password_form.hidden_tag() }}
|
||||
{{ render_field_with_errors(forgot_password_form.email) }}
|
||||
|
||||
@@ -8,4 +8,13 @@
|
||||
{{ render_field_with_errors(login_form.remember) }}
|
||||
{{ render_field(login_form.next) }}
|
||||
{{ render_field(login_form.submit) }}
|
||||
</form>
|
||||
</form>
|
||||
<h2>Help</h2>
|
||||
<p>
|
||||
{% if security.recoverable %}
|
||||
<a href="{{ url_for_security('forgot_password') }}">Forgot password</a><br/>
|
||||
{% endif %}
|
||||
{% if security.confirmabled %}
|
||||
<a href="{{ url_for_security('send_confirmation') }}">Confirm account</a>
|
||||
{% endif %}
|
||||
</p>
|
||||
Reference in New Issue
Block a user