From eeace79ef95a2473936b3051e4b7ab7a3498f58c Mon Sep 17 00:00:00 2001 From: Matt Wright Date: Thu, 16 Aug 2012 18:03:47 -0400 Subject: [PATCH] Update default login template and add security state to app context processory --- example/templates/login.html | 11 ----------- flask_security/core.py | 5 +++-- .../templates/security/forgot_password.html | 2 +- flask_security/templates/security/login.html | 11 ++++++++++- 4 files changed, 14 insertions(+), 15 deletions(-) delete mode 100644 example/templates/login.html diff --git a/example/templates/login.html b/example/templates/login.html deleted file mode 100644 index 231bb56..0000000 --- a/example/templates/login.html +++ /dev/null @@ -1,11 +0,0 @@ -{% include "_messages.html" %} -{% include "_nav.html" %} -
- {{ form.hidden_tag() }} - {{ form.email.label }} {{ form.email }}
- {{ form.password.label }} {{ form.password }}
- {{ form.remember.label }} {{ form.remember }}
- {{ form.next }} - {{ form.submit }} -
-

{{ content }}

diff --git a/flask_security/core.py b/flask_security/core.py index 501c560..64cdc0c 100644 --- a/flask_security/core.py +++ b/flask_security/core.py @@ -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): diff --git a/flask_security/templates/security/forgot_password.html b/flask_security/templates/security/forgot_password.html index 27a0d54..be818dc 100644 --- a/flask_security/templates/security/forgot_password.html +++ b/flask_security/templates/security/forgot_password.html @@ -1,6 +1,6 @@ {% from "security/_macros.html" import render_field_with_errors, render_field %} {% include "security/_messages.html" %} -

Send reset password instructions

+

Send password reset instructions

{{ forgot_password_form.hidden_tag() }} {{ render_field_with_errors(forgot_password_form.email) }} diff --git a/flask_security/templates/security/login.html b/flask_security/templates/security/login.html index 9d9c26f..dd74601 100644 --- a/flask_security/templates/security/login.html +++ b/flask_security/templates/security/login.html @@ -8,4 +8,13 @@ {{ render_field_with_errors(login_form.remember) }} {{ render_field(login_form.next) }} {{ render_field(login_form.submit) }} -
\ No newline at end of file + +

Help

+

+ {% if security.recoverable %} + Forgot password
+ {% endif %} + {% if security.confirmabled %} + Confirm account + {% endif %} +

\ No newline at end of file