handle the case new_email can be None if user cancels change in the meantime
This commit is contained in:
parent
743170e983
commit
aadda7cb0d
|
@ -158,8 +158,12 @@ def mailbox_confirm_change_route():
|
|||
r_id = int(s.unsign(mailbox_id))
|
||||
except BadSignature:
|
||||
flash("Invalid link", "error")
|
||||
return redirect(url_for("dashboard.index"))
|
||||
else:
|
||||
mailbox = Mailbox.get(r_id)
|
||||
|
||||
# new_email can be None if user cancels change in the meantime
|
||||
if mailbox and mailbox.new_email:
|
||||
mailbox.email = mailbox.new_email
|
||||
mailbox.new_email = None
|
||||
|
||||
|
@ -172,3 +176,7 @@ def mailbox_confirm_change_route():
|
|||
return redirect(
|
||||
url_for("dashboard.mailbox_detail_route", mailbox_id=mailbox.id)
|
||||
)
|
||||
else:
|
||||
flash("Invalid link", "error")
|
||||
return redirect(url_for("dashboard.index"))
|
||||
|
||||
|
|
Loading…
Reference in a new issue