From 4019e82f4a67d9232aad1a0ee2684e69d4b12b58 Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Sat, 5 Dec 2020 21:43:30 +0000 Subject: [PATCH] Add username-less redirect to email settings --- app/blueprints/users/settings.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/blueprints/users/settings.py b/app/blueprints/users/settings.py index b2636d4a..b4d7153f 100644 --- a/app/blueprints/users/settings.py +++ b/app/blueprints/users/settings.py @@ -145,11 +145,13 @@ def handle_email_notifications(user, prefs, is_new, form): return redirect(url_for("users.email_notifications", username=user.username)) - - +@bp.route("/user/settings/email/") @bp.route("/users//settings/email/", methods=["GET", "POST"]) @login_required -def email_notifications(username): +def email_notifications(username=None): + if username is None: + return redirect(url_for("users.email_notifications", username=current_user.username)) + user: User = User.query.filter_by(username=username).first() if not user: abort(404)