Add registration message

This commit is contained in:
Matt Wright
2012-08-16 18:53:27 -04:00
parent d87676027e
commit dec858dae9
5 changed files with 9 additions and 5 deletions
+3 -2
View File
@@ -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'),
@@ -1,5 +1,5 @@
<p>Welcome {{ user.email }}!</p>
<p>You can confirm your account email through the link below:</p>
<p>You can confirm your email through the link below:</p>
<p><a href="{{ confirmation_link }}">Confirm my account</a></p>
@@ -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 }}
@@ -1,6 +1,6 @@
{% from "security/_macros.html" import render_field_with_errors, render_field %}
{% include "security/_messages.html" %}
<h1>Change password</h1>
<h1>Reset password</h1>
<form action="{{ url_for_security('reset_password', token=password_reset_token) }}" method="POST" name="reset_password_form">
{{ reset_password_form.hidden_tag() }}
{{ render_field_with_errors(reset_password_form.password) }}
+3
View File
@@ -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))