diff --git a/app/auth/views/register.py b/app/auth/views/register.py index a616771c..0fa89276 100644 --- a/app/auth/views/register.py +++ b/app/auth/views/register.py @@ -46,7 +46,7 @@ def register(): if personal_email_already_used(email): flash(f"Email {email} already used", "error") else: - LOG.debug("create user %s", form.email.data) + LOG.debug("create user %s", email) user = User.create( email=email, name="", diff --git a/app/auth/views/resend_activation.py b/app/auth/views/resend_activation.py index 88292f5b..ea8d10c6 100644 --- a/app/auth/views/resend_activation.py +++ b/app/auth/views/resend_activation.py @@ -17,7 +17,7 @@ def resend_activation(): form = ResendActivationForm(request.form) if form.validate_on_submit(): - user = User.filter_by(email=form.email.data).first() + user = User.filter_by(email=form.email.data.strip().lower()).first() if not user: flash("There is no such email", "warning") diff --git a/app/dashboard/views/alias_contact_manager.py b/app/dashboard/views/alias_contact_manager.py index 3e65fd18..cf899136 100644 --- a/app/dashboard/views/alias_contact_manager.py +++ b/app/dashboard/views/alias_contact_manager.py @@ -72,7 +72,7 @@ def alias_contact_manager(alias_id): if request.method == "POST": if request.form.get("form-name") == "create": if new_contact_form.validate(): - contact_addr = new_contact_form.email.data.strip() + contact_addr = new_contact_form.email.data.strip().lower() # generate a reply_email, make sure it is unique # not use while to avoid infinite loop diff --git a/app/dashboard/views/setting.py b/app/dashboard/views/setting.py index 97e94ed3..8b3b6442 100644 --- a/app/dashboard/views/setting.py +++ b/app/dashboard/views/setting.py @@ -67,10 +67,10 @@ def setting(): if request.form.get("form-name") == "update-email": if change_email_form.validate(): if ( - change_email_form.email.data != current_user.email + change_email_form.email.data.lower().strip() != current_user.email and not pending_email ): - new_email = change_email_form.email.data + new_email = change_email_form.email.data.strip().lower() # check if this email is not already used if personal_email_already_used(new_email) or Alias.get_by(