From dec858dae98bed40dc62c3662ca16f152935e888 Mon Sep 17 00:00:00 2001 From: Matt Wright Date: Thu, 16 Aug 2012 18:53:27 -0400 Subject: [PATCH] Add registration message --- flask_security/core.py | 5 +++-- .../templates/security/email/confirmation_instructions.html | 2 +- .../templates/security/email/confirmation_instructions.txt | 2 +- flask_security/templates/security/reset_password.html | 2 +- flask_security/views.py | 3 +++ 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/flask_security/core.py b/flask_security/core.py index 80e66ef..3db091a 100644 --- a/flask_security/core.py +++ b/flask_security/core.py @@ -76,6 +76,7 @@ _default_config = { #: Default Flask-Security messages _default_messages = { 'UNAUTHORIZED': ('You do not have permission to view this resource.', 'error'), + 'CONFIRM_REGISTRATION': ('Thank you. Confirmation instructions have been sent to %(email)s.', 'success'), 'EMAIL_CONFIRMED': ('Your email has been confirmed. You may now log in.', 'success'), 'ALREADY_CONFIRMED': ('Your email has already been confirmed.', 'info'), 'INVALID_CONFIRMATION_TOKEN': ('Invalid confirmation token.', 'error'), @@ -85,8 +86,8 @@ _default_messages = { 'CONFIRMATION_REQUIRED': ('Email requires confirmation.', 'error'), 'CONFIRMATION_REQUEST': ('Confirmation instructions have been sent to %(email)s.', 'info'), 'CONFIRMATION_EXPIRED': ('You did not confirm your email within %(within)s. New instructions to confirm your email have been sent to %(email)s.', 'error'), - 'LOGIN_EXPIRED': ('You did not login within %(within)s. New instructions to login to your account have been sent to %(email)s.', 'error'), - 'LOGIN_EMAIL_SENT': ('Instructions to log in to your account have been sent to %(email)s.', 'success'), + 'LOGIN_EXPIRED': ('You did not login within %(within)s. New instructions to login have been sent to %(email)s.', 'error'), + 'LOGIN_EMAIL_SENT': ('Instructions to login have been sent to %(email)s.', 'success'), 'INVALID_LOGIN_TOKEN': ('Invalid login token.', 'error'), 'DISABLED_ACCOUNT': ('Account is disabled.', 'error'), 'PASSWORDLESS_LOGIN_SUCCESSFUL': ('You have successfuly logged in.', 'success'), diff --git a/flask_security/templates/security/email/confirmation_instructions.html b/flask_security/templates/security/email/confirmation_instructions.html index 3f7c840..92badd0 100644 --- a/flask_security/templates/security/email/confirmation_instructions.html +++ b/flask_security/templates/security/email/confirmation_instructions.html @@ -1,5 +1,5 @@

Welcome {{ user.email }}!

-

You can confirm your account email through the link below:

+

You can confirm your email through the link below:

Confirm my account

\ No newline at end of file diff --git a/flask_security/templates/security/email/confirmation_instructions.txt b/flask_security/templates/security/email/confirmation_instructions.txt index c253460..e6a4a3a 100644 --- a/flask_security/templates/security/email/confirmation_instructions.txt +++ b/flask_security/templates/security/email/confirmation_instructions.txt @@ -1,5 +1,5 @@ Welcome {{ user.email }}! -You can confirm your account email through the link below: +You can confirm your email through the link below: {{ confirmation_link }} \ No newline at end of file diff --git a/flask_security/templates/security/reset_password.html b/flask_security/templates/security/reset_password.html index ca573c8..b383df0 100644 --- a/flask_security/templates/security/reset_password.html +++ b/flask_security/templates/security/reset_password.html @@ -1,6 +1,6 @@ {% from "security/_macros.html" import render_field_with_errors, render_field %} {% include "security/_messages.html" %} -

Change password

+

Reset password

{{ reset_password_form.hidden_tag() }} {{ render_field_with_errors(reset_password_form.password) }} diff --git a/flask_security/views.py b/flask_security/views.py index 81432b2..de03d74 100644 --- a/flask_security/views.py +++ b/flask_security/views.py @@ -141,6 +141,9 @@ def register(): if not _security.confirmable or _security.login_without_confirmation: login_user(u) + if _security.confirmable: + do_flash(*get_message('CONFIRM_REGISTRATION', email=u.email)) + return redirect(get_url(_security.post_register_view) or get_url(_security.post_login_view))