From 32a9bd9095f2f7b4b60a7672ec5760192551d7d9 Mon Sep 17 00:00:00 2001 From: Son NK <> Date: Wed, 20 May 2020 18:16:18 +0200 Subject: [PATCH] make sure to use lowercase for mailbox email --- .gitignore | 3 ++- app/dashboard/views/mailbox.py | 2 +- app/dashboard/views/mailbox_detail.py | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index c520b5be..bd62ebfd 100644 --- a/.gitignore +++ b/.gitignore @@ -9,4 +9,5 @@ config static/node_modules db.sqlite-journal static/upload -adhoc_* \ No newline at end of file +adhoc_* +adhoc.py \ No newline at end of file diff --git a/app/dashboard/views/mailbox.py b/app/dashboard/views/mailbox.py index 9e02e0b1..8f1a99eb 100644 --- a/app/dashboard/views/mailbox.py +++ b/app/dashboard/views/mailbox.py @@ -82,7 +82,7 @@ def mailbox_route(): return redirect(url_for("dashboard.mailbox_route")) if new_mailbox_form.validate(): - mailbox_email = new_mailbox_form.email.data.lower() + mailbox_email = new_mailbox_form.email.data.lower().strip() if mailbox_already_used(mailbox_email, current_user): flash(f"{mailbox_email} already used", "error") diff --git a/app/dashboard/views/mailbox_detail.py b/app/dashboard/views/mailbox_detail.py index 01bb8aa8..53478a33 100644 --- a/app/dashboard/views/mailbox_detail.py +++ b/app/dashboard/views/mailbox_detail.py @@ -45,7 +45,7 @@ def mailbox_detail_route(mailbox_id): request.form.get("form-name") == "update-email" and change_email_form.validate_on_submit() ): - new_email = change_email_form.email.data + new_email = change_email_form.email.data.lower().strip() if new_email != mailbox.email and not pending_email: # check if this email is not already used if ( @@ -112,7 +112,7 @@ def mailbox_detail_route(mailbox_id): flash( "SPF enforcement was " + "enabled" if request.form.get("spf-status") - else "disabled" + " succesfully", + else "disabled" + " successfully", "success", ) return redirect(