Переглянути джерело

make sure to use lowercase for mailbox email

Son NK 5 роки тому
батько
коміт
32a9bd9095
3 змінених файлів з 5 додано та 4 видалено
  1. 2 1
      .gitignore
  2. 1 1
      app/dashboard/views/mailbox.py
  3. 2 2
      app/dashboard/views/mailbox_detail.py

+ 2 - 1
.gitignore

@@ -9,4 +9,5 @@ config
 static/node_modules
 static/node_modules
 db.sqlite-journal
 db.sqlite-journal
 static/upload
 static/upload
-adhoc_*
+adhoc_*
+adhoc.py

+ 1 - 1
app/dashboard/views/mailbox.py

@@ -82,7 +82,7 @@ def mailbox_route():
                 return redirect(url_for("dashboard.mailbox_route"))
                 return redirect(url_for("dashboard.mailbox_route"))
 
 
             if new_mailbox_form.validate():
             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):
                 if mailbox_already_used(mailbox_email, current_user):
                     flash(f"{mailbox_email} already used", "error")
                     flash(f"{mailbox_email} already used", "error")

+ 2 - 2
app/dashboard/views/mailbox_detail.py

@@ -45,7 +45,7 @@ def mailbox_detail_route(mailbox_id):
             request.form.get("form-name") == "update-email"
             request.form.get("form-name") == "update-email"
             and change_email_form.validate_on_submit()
             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:
             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 (
@@ -112,7 +112,7 @@ def mailbox_detail_route(mailbox_id):
             flash(
             flash(
                 "SPF enforcement was " + "enabled"
                 "SPF enforcement was " + "enabled"
                 if request.form.get("spf-status")
                 if request.form.get("spf-status")
-                else "disabled" + " succesfully",
+                else "disabled" + " successfully",
                 "success",
                 "success",
             )
             )
             return redirect(
             return redirect(