make /settings/log_out_all_others redirect

master
Aevann 2023-01-27 13:33:03 +02:00
parent 91086d76c5
commit f1877be84e
1 changed files with 6 additions and 3 deletions

View File

@ -533,12 +533,13 @@ def settings_security_post(v):
def settings_log_out_others(v): def settings_log_out_others(v):
submitted_password = request.values.get("password", "").strip() submitted_password = request.values.get("password", "").strip()
if not v.verifyPass(submitted_password): if not v.verifyPass(submitted_password):
return render_template("settings/security.html", v=v, error="Incorrect Password"), 401 return redirect("/settings/security?error=Incorrect password!")
v.login_nonce += 1 v.login_nonce += 1
session["login_nonce"] = v.login_nonce session["login_nonce"] = v.login_nonce
g.db.add(v) g.db.add(v)
return render_template("settings/security.html", v=v, msg="All other devices have been logged out")
return redirect("/settings/security?msg=All other devices have been logged out!")
@app.post("/settings/images/profile") @app.post("/settings/images/profile")
@ -638,7 +639,9 @@ def settings_security(v:User):
return render_template("settings/security.html", return render_template("settings/security.html",
v=v, v=v,
mfa_secret=pyotp.random_base32() if not v.mfa_secret else None, mfa_secret=pyotp.random_base32() if not v.mfa_secret else None,
now=int(time.time()) now=int(time.time()),
error=get_error(),
msg=get_msg()
) )
@app.post("/settings/block") @app.post("/settings/block")