Redirect signed-in users to their service

Some users are bookmarking the sign in page for quick access to their
Notify service.

If they’re already signed in when they used this bookmark they get
redirected. However the redirect isn’t very smart, because it just takes
them to their list of services. This isn’t great if they only have one
service.

This commit redirects them to the `show_accounts_or_dashboard` endpoint
instead, which does the work to figure out which page is most useful
to show someone when they sign in.

Also changing this for `/register`, although it’s less likely that
someone will have bookmarked this page.
This commit is contained in:
Chris Hill-Scott
2018-11-15 15:38:43 +00:00
parent dd72a9d333
commit be9fb99247
5 changed files with 17 additions and 18 deletions

View File

@@ -16,7 +16,7 @@ from app.main.views.verify import activate_user
@main.route('/register', methods=['GET', 'POST'])
def register():
if current_user and current_user.is_authenticated:
return redirect(url_for('main.choose_account'))
return redirect(url_for('main.show_accounts_or_dashboard'))
form = RegisterUserForm()
if form.validate_on_submit():

View File

@@ -18,7 +18,7 @@ from app.main.forms import LoginForm
@main.route('/sign-in', methods=(['GET', 'POST']))
def sign_in():
if current_user and current_user.is_authenticated:
return redirect(url_for('main.choose_account'))
return redirect(url_for('main.show_accounts_or_dashboard'))
form = LoginForm()