Add username-less redirect to email settings
This commit is contained in:
parent
79230c1b0e
commit
4019e82f4a
|
@ -145,11 +145,13 @@ def handle_email_notifications(user, prefs, is_new, form):
|
||||||
return redirect(url_for("users.email_notifications", username=user.username))
|
return redirect(url_for("users.email_notifications", username=user.username))
|
||||||
|
|
||||||
|
|
||||||
|
@bp.route("/user/settings/email/")
|
||||||
|
|
||||||
@bp.route("/users/<username>/settings/email/", methods=["GET", "POST"])
|
@bp.route("/users/<username>/settings/email/", methods=["GET", "POST"])
|
||||||
@login_required
|
@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()
|
user: User = User.query.filter_by(username=username).first()
|
||||||
if not user:
|
if not user:
|
||||||
abort(404)
|
abort(404)
|
||||||
|
|
Loading…
Reference in New Issue