make sure to strip and lower email

This commit is contained in:
Son NK 2020-06-11 23:35:24 +02:00
parent cadbe7d32b
commit 4ee38823b8
4 changed files with 5 additions and 5 deletions

View File

@ -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="",

View File

@ -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")

View File

@ -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

View File

@ -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(