diff --git a/flask_security/core.py b/flask_security/core.py
index 794e5fb..80e66ef 100644
--- a/flask_security/core.py
+++ b/flask_security/core.py
@@ -45,12 +45,12 @@ _default_config = {
'LOGIN_VIEW': '/login',
'POST_LOGIN_VIEW': '/',
'POST_LOGOUT_VIEW': '/',
- 'POST_FORGOT_VIEW': '/',
- 'RESET_PASSWORD_ERROR_VIEW': '/',
+ 'POST_FORGOT_VIEW': None,
'CONFIRM_ERROR_VIEW': None,
'POST_REGISTER_VIEW': None,
'POST_CONFIRM_VIEW': None,
'POST_RESET_VIEW': None,
+ 'RESET_PASSWORD_ERROR_VIEW': None,
'UNAUTHORIZED_VIEW': None,
'DEFAULT_ROLES': [],
'CONFIRMABLE': False,
diff --git a/flask_security/templates/security/_messages.html b/flask_security/templates/security/_messages.html
index 788a413..179d063 100644
--- a/flask_security/templates/security/_messages.html
+++ b/flask_security/templates/security/_messages.html
@@ -1,6 +1,6 @@
{%- with messages = get_flashed_messages(with_categories=true) -%}
{% if messages %}
-
+
{% for category, message in messages %}
- {{ message }}
{% endfor %}
diff --git a/flask_security/views.py b/flask_security/views.py
index 514fc0d..81432b2 100644
--- a/flask_security/views.py
+++ b/flask_security/views.py
@@ -246,8 +246,8 @@ def forgot_password():
do_flash(*get_message('PASSWORD_RESET_REQUEST', email=user.email))
- return redirect(get_url(_security.post_forgot_view))
-
+ if _security.post_forgot_view:
+ return redirect(get_url(_security.post_forgot_view))
else:
for key, value in form.errors.items():
do_flash(value[0], 'error')
@@ -289,6 +289,9 @@ def reset_password(token):
do_flash(*msg)
+ if _security.reset_password_error_view:
+ return redirect(get_url(_security.reset_password_error_view))
+
return render_template('security/reset_password.html',
reset_password_form=form,
password_reset_token=token)
diff --git a/tests/functional_tests.py b/tests/functional_tests.py
index 24914b3..b913c64 100644
--- a/tests/functional_tests.py
+++ b/tests/functional_tests.py
@@ -370,6 +370,8 @@ class RecoverableTests(SecurityTest):
AUTH_CONFIG = {
'SECURITY_RECOVERABLE': True,
+ 'SECURITY_RESET_PASSWORD_ERROR_VIEW': '/',
+ 'SECURITY_POST_FORGOT_VIEW': '/'
}
def test_forgot_post_sends_email(self):