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)
try:
user_id = int(s.unsign(mfa_key))
except BadSignature:
except Exception:
return jsonify(error="Invalid mfa_key"), 400
user = User.get(user_id)

View file

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

View file

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