Add optional next parameter to registration endpoint. Fixes #117.

This commit is contained in:
Matt Wright
2013-05-28 11:01:42 -04:00
parent db56ff74a9
commit bf260d4b7e
5 changed files with 41 additions and 17 deletions
+10 -3
View File
@@ -144,11 +144,18 @@ def url_for_security(endpoint, **values):
return url_for(endpoint, **values)
def get_post_login_redirect():
"""Returns the URL to redirect to after a user logs in successfully."""
def get_post_action_redirect(config_key):
return (get_url(request.args.get('next')) or
get_url(request.form.get('next')) or
find_redirect('SECURITY_POST_LOGIN_VIEW'))
find_redirect(config_key))
def get_post_login_redirect():
return get_post_action_redirect('SECURITY_POST_LOGIN_VIEW')
def get_post_register_redirect():
return get_post_action_redirect('SECURITY_POST_REGISTER_VIEW')
def find_redirect(key):