This commit is contained in:
Son NK 2020-05-23 19:50:36 +02:00
parent 9bb17533c1
commit dfb427e6da

View file

@ -48,9 +48,8 @@ def mailbox_detail_route(mailbox_id):
new_email = change_email_form.email.data.lower().strip() new_email = change_email_form.email.data.lower().strip()
if new_email != mailbox.email and not pending_email: if new_email != mailbox.email and not pending_email:
# check if this email is not already used # check if this email is not already used
if ( if mailbox_already_used(new_email, current_user) or Alias.get_by(
mailbox_already_used(new_email, current_user) email=new_email
or Alias.get_by(email=new_email)
): ):
flash(f"Email {new_email} already used", "error") flash(f"Email {new_email} already used", "error")
elif not email_domain_can_be_used_as_mailbox(new_email): elif not email_domain_can_be_used_as_mailbox(new_email):