Handle unsign can generate other exceptions

This commit is contained in:
Son NK 2020-03-09 09:17:40 +01:00
parent aadda7cb0d
commit b05daecd28
3 changed files with 4 additions and 4 deletions

View file

@ -38,7 +38,7 @@ def auth_mfa():
s = Signer(FLASK_SECRET) s = Signer(FLASK_SECRET)
try: try:
user_id = int(s.unsign(mfa_key)) user_id = int(s.unsign(mfa_key))
except BadSignature: except Exception:
return jsonify(error="Invalid mfa_key"), 400 return jsonify(error="Invalid mfa_key"), 400
user = User.get(user_id) user = User.get(user_id)

View file

@ -142,8 +142,9 @@ def mailbox_verify():
try: try:
r_id = int(s.unsign(mailbox_id)) r_id = int(s.unsign(mailbox_id))
except BadSignature: except Exception:
flash("Invalid link. Please delete and re-add your mailbox", "error") flash("Invalid link. Please delete and re-add your mailbox", "error")
return redirect(url_for("dashboard.mailbox_route"))
else: else:
mailbox = Mailbox.get(r_id) mailbox = Mailbox.get(r_id)
mailbox.verified = True mailbox.verified = True

View file

@ -156,7 +156,7 @@ def mailbox_confirm_change_route():
try: try:
r_id = int(s.unsign(mailbox_id)) r_id = int(s.unsign(mailbox_id))
except BadSignature: except Exception:
flash("Invalid link", "error") flash("Invalid link", "error")
return redirect(url_for("dashboard.index")) return redirect(url_for("dashboard.index"))
else: else:
@ -179,4 +179,3 @@ def mailbox_confirm_change_route():
else: else:
flash("Invalid link", "error") flash("Invalid link", "error")
return redirect(url_for("dashboard.index")) return redirect(url_for("dashboard.index"))