From 1b505d0f3956f7a87b75ed27a69c2c2e6fc147ab Mon Sep 17 00:00:00 2001 From: Matt Wright Date: Wed, 15 Aug 2012 19:22:06 -0400 Subject: [PATCH] Update default templates --- .../templates/security/confirmations/new.html | 5 +++-- .../templates/security/logins/new.html | 11 ++++++----- .../templates/security/logins/passwordless.html | 7 ++++--- flask_security/templates/security/macros.html | 16 ++++++++++++++++ .../templates/security/passwords/edit.html | 7 ++++--- .../templates/security/passwords/new.html | 5 +++-- .../templates/security/registrations/edit.html | 13 +++++++------ .../templates/security/registrations/new.html | 9 +++++---- 8 files changed, 48 insertions(+), 25 deletions(-) create mode 100644 flask_security/templates/security/macros.html diff --git a/flask_security/templates/security/confirmations/new.html b/flask_security/templates/security/confirmations/new.html index 7bece48..e3e523c 100644 --- a/flask_security/templates/security/confirmations/new.html +++ b/flask_security/templates/security/confirmations/new.html @@ -1,7 +1,8 @@ +{% from "security/macros.html" import render_field_with_errors, render_field %} {% include "security/messages.html" %}

Resend confirmation instructions

{{ reset_confirmation_form.hidden_tag() }} - {{ reset_confirmation_form.email.label }} {{ reset_confirmation_form.email }} - {{ reset_confirmation_form.submit }} + {{ render_field_with_errors(reset_confirmation_form.email) }} + {{ render_field(reset_confirmation_form.submit) }}
\ No newline at end of file diff --git a/flask_security/templates/security/logins/new.html b/flask_security/templates/security/logins/new.html index f5d9998..a81d1fe 100644 --- a/flask_security/templates/security/logins/new.html +++ b/flask_security/templates/security/logins/new.html @@ -1,10 +1,11 @@ +{% from "security/macros.html" import render_field_with_errors, render_field %} {% include "security/messages.html" %}

Login

{{ login_form.hidden_tag() }} - {{ login_form.email.label }} {{ login_form.email }}
- {{ login_form.password.label }} {{ login_form.password }}
- {{ login_form.remember.label }} {{ login_form.remember }}
- {{ login_form.next }} - {{ login_form.submit }} + {{ render_field_with_errors(login_form.email) }} + {{ render_field_with_errors(login_form.password) }} + {{ render_field_with_errors(login_form.remember) }} + {{ render_field(login_form.next) }} + {{ render_field(login_form.submit) }}
\ No newline at end of file diff --git a/flask_security/templates/security/logins/passwordless.html b/flask_security/templates/security/logins/passwordless.html index ee49871..d0f353e 100644 --- a/flask_security/templates/security/logins/passwordless.html +++ b/flask_security/templates/security/logins/passwordless.html @@ -1,8 +1,9 @@ +{% from "security/macros.html" import render_field_with_errors, render_field %} {% include "security/messages.html" %}

Login

{{ login_form.hidden_tag() }} - {{ login_form.email.label }} {{ login_form.email }}
- {{ login_form.next }} - {{ login_form.submit }} + {{ render_field_with_errors(login_form.email) }} + {{ render_field(login_form.next) }} + {{ render_field(login_form.submit) }}
\ No newline at end of file diff --git a/flask_security/templates/security/macros.html b/flask_security/templates/security/macros.html new file mode 100644 index 0000000..8575f3d --- /dev/null +++ b/flask_security/templates/security/macros.html @@ -0,0 +1,16 @@ +{% macro render_field_with_errors(field) %} +

+ {{ field.label }} {{ field(**kwargs)|safe }} + {% if field.errors %} +

+ {% endif %} +

+{% endmacro %} + +{% macro render_field(field) %} +

{{ field(**kwargs)|safe }}

+{% endmacro %} \ No newline at end of file diff --git a/flask_security/templates/security/passwords/edit.html b/flask_security/templates/security/passwords/edit.html index e806d0d..4a505be 100644 --- a/flask_security/templates/security/passwords/edit.html +++ b/flask_security/templates/security/passwords/edit.html @@ -1,8 +1,9 @@ +{% from "security/macros.html" import render_field_with_errors, render_field %} {% include "security/messages.html" %}

Change password

{{ reset_password_form.hidden_tag() }} - {{ reset_password_form.password.label }} {{ reset_password_form.password }}
- {{ reset_password_form.password_confirm.label }} {{ reset_password_form.password_confirm }}
- {{ reset_password_form.submit }} + {{ render_field_with_errors(reset_password_form.password) }} + {{ render_field_with_errors(reset_password_form.password_confirm) }} + {{ render_field(reset_password_form.submit) }}
\ No newline at end of file diff --git a/flask_security/templates/security/passwords/new.html b/flask_security/templates/security/passwords/new.html index c5b2a93..31c4f1f 100644 --- a/flask_security/templates/security/passwords/new.html +++ b/flask_security/templates/security/passwords/new.html @@ -1,7 +1,8 @@ +{% from "security/macros.html" import render_field_with_errors, render_field %} {% include "security/messages.html" %}

Send reset password instructions

{{ forgot_password_form.hidden_tag() }} - {{ forgot_password_form.email.label }} {{ forgot_password_form.email }} - {{ forgot_password_form.submit }} + {{ render_field_with_errors(forgot_password_form.email) }} + {{ render_field(forgot_password_form.submit) }}
\ No newline at end of file diff --git a/flask_security/templates/security/registrations/edit.html b/flask_security/templates/security/registrations/edit.html index de100f7..0d5c637 100644 --- a/flask_security/templates/security/registrations/edit.html +++ b/flask_security/templates/security/registrations/edit.html @@ -1,10 +1,11 @@ +{% from "security/macros.html" import render_field_with_errors, render_field %} {% include "security/messages.html" %} -

Edit account

+

Edit Account

{{ edit_user_form.hidden_tag() }} - {{ edit_user_form.email.label }} {{ edit_user_form.email }}
- {{ edit_user_form.password.label }} {{ edit_user_form.password }}
- {{ edit_user_form.password_confirm.label }} {{ edit_user_form.password_confirm }}
- {{ edit_user_form.current_password.label }} {{ edit_user_form.current_password }}
- {{ edit_user_form.submit }} + {{ render_field_with_errors(edit_user_form.email) }} + {{ render_field_with_errors(edit_user_form.password) }} + {{ render_field_with_errors(edit_user_form.password_confirm) }} + {{ render_field_with_errors(edit_user_form.current_password) }} + {{ render_field(edit_user_form.submit) }}
\ No newline at end of file diff --git a/flask_security/templates/security/registrations/new.html b/flask_security/templates/security/registrations/new.html index 133f5d8..b9f9773 100644 --- a/flask_security/templates/security/registrations/new.html +++ b/flask_security/templates/security/registrations/new.html @@ -1,9 +1,10 @@ +{% from "security/macros.html" import render_field_with_errors, render_field %} {% include "security/messages.html" %}

Register

{{ register_user_form.hidden_tag() }} - {{ register_user_form.email.label }} {{ register_user_form.email }}
- {{ register_user_form.password.label }} {{ register_user_form.password }}
- {{ register_user_form.password_confirm.label }} {{ register_user_form.password_confirm }}
- {{ register_user_form.submit }} + {{ render_field_with_errors(register_user_form.email) }} + {{ render_field_with_errors(register_user_form.password) }} + {{ render_field_with_errors(register_user_form.password_confirm) }} + {{ render_field(register_user_form.submit) }}
\ No newline at end of file