rename email_domain_can_be_used_as_mailbox -> email_can_be_used_as_mailbox

This commit is contained in:
Son NK 2020-10-15 16:05:47 +02:00
parent f56b0cddb2
commit 90163220cf
6 changed files with 17 additions and 19 deletions

View file

@ -12,7 +12,7 @@ from app.api.base import api_bp
from app.config import FLASK_SECRET, DISABLE_REGISTRATION
from app.dashboard.views.setting import send_reset_password_email
from app.email_utils import (
email_domain_can_be_used_as_mailbox,
email_can_be_used_as_mailbox,
personal_email_already_used,
send_email,
render,
@ -89,9 +89,7 @@ def auth_register():
if DISABLE_REGISTRATION:
return jsonify(error="registration is closed"), 400
if not email_domain_can_be_used_as_mailbox(email) or personal_email_already_used(
email
):
if not email_can_be_used_as_mailbox(email) or personal_email_already_used(email):
return jsonify(error=f"cannot use {email} as personal inbox"), 400
if not password or len(password) < 8:
@ -249,9 +247,9 @@ def auth_facebook():
if not user:
if DISABLE_REGISTRATION:
return jsonify(error="registration is closed"), 400
if not email_domain_can_be_used_as_mailbox(
if not email_can_be_used_as_mailbox(email) or personal_email_already_used(
email
) or personal_email_already_used(email):
):
return jsonify(error=f"cannot use {email} as personal inbox"), 400
LOG.d("create facebook user with %s", user_info)
@ -302,9 +300,9 @@ def auth_google():
if not user:
if DISABLE_REGISTRATION:
return jsonify(error="registration is closed"), 400
if not email_domain_can_be_used_as_mailbox(
if not email_can_be_used_as_mailbox(email) or personal_email_already_used(
email
) or personal_email_already_used(email):
):
return jsonify(error=f"cannot use {email} as personal inbox"), 400
LOG.d("create Google user with %s", user_info)

View file

@ -9,7 +9,7 @@ from app.dashboard.views.mailbox import send_verification_email
from app.dashboard.views.mailbox_detail import verify_mailbox_change
from app.email_utils import (
mailbox_already_used,
email_domain_can_be_used_as_mailbox,
email_can_be_used_as_mailbox,
)
from app.extensions import db
from app.models import Mailbox
@ -34,7 +34,7 @@ def create_mailbox():
if mailbox_already_used(mailbox_email, user):
return jsonify(error=f"{mailbox_email} already used"), 400
elif not email_domain_can_be_used_as_mailbox(mailbox_email):
elif not email_can_be_used_as_mailbox(mailbox_email):
return (
jsonify(
error=f"{mailbox_email} cannot be used. Please note a mailbox cannot "
@ -118,7 +118,7 @@ def update_mailbox(mailbox_id):
if mailbox_already_used(new_email, user):
return jsonify(error=f"{new_email} already used"), 400
elif not email_domain_can_be_used_as_mailbox(new_email):
elif not email_can_be_used_as_mailbox(new_email):
return (
jsonify(
error=f"{new_email} cannot be used. Please note a mailbox cannot "

View file

@ -9,7 +9,7 @@ from app.auth.base import auth_bp
from app.auth.views.login_utils import get_referral
from app.config import URL, HCAPTCHA_SECRET, HCAPTCHA_SITEKEY
from app.email_utils import (
email_domain_can_be_used_as_mailbox,
email_can_be_used_as_mailbox,
personal_email_already_used,
)
from app.extensions import db
@ -67,7 +67,7 @@ def register():
)
email = form.email.data.strip().lower()
if not email_domain_can_be_used_as_mailbox(email):
if not email_can_be_used_as_mailbox(email):
flash("You cannot use this email address as your personal inbox.", "error")
else:

View file

@ -8,7 +8,7 @@ from wtforms.fields.html5 import EmailField
from app.config import EMAIL_DOMAIN, ALIAS_DOMAINS, MAILBOX_SECRET, URL
from app.dashboard.base import dashboard_bp
from app.email_utils import (
email_domain_can_be_used_as_mailbox,
email_can_be_used_as_mailbox,
mailbox_already_used,
render,
send_email,
@ -88,7 +88,7 @@ def mailbox_route():
if mailbox_already_used(mailbox_email, current_user):
flash(f"{mailbox_email} already used", "error")
elif not email_domain_can_be_used_as_mailbox(mailbox_email):
elif not email_can_be_used_as_mailbox(mailbox_email):
flash(f"You cannot use {mailbox_email}.", "error")
else:
new_mailbox = Mailbox.create(

View file

@ -10,7 +10,7 @@ from wtforms.fields.html5 import EmailField
from app.config import ENFORCE_SPF, MAILBOX_SECRET
from app.config import URL
from app.dashboard.base import dashboard_bp
from app.email_utils import email_domain_can_be_used_as_mailbox
from app.email_utils import email_can_be_used_as_mailbox
from app.email_utils import mailbox_already_used, render, send_email
from app.extensions import db
from app.log import LOG
@ -52,7 +52,7 @@ def mailbox_detail_route(mailbox_id):
email=new_email
):
flash(f"Email {new_email} already used", "error")
elif not email_domain_can_be_used_as_mailbox(new_email):
elif not email_can_be_used_as_mailbox(new_email):
flash("You cannot use this email address as your mailbox", "error")
else:
mailbox.new_email = new_email

View file

@ -22,7 +22,7 @@ from app import s3, email_utils
from app.config import URL, FIRST_ALIAS_DOMAIN
from app.dashboard.base import dashboard_bp
from app.email_utils import (
email_domain_can_be_used_as_mailbox,
email_can_be_used_as_mailbox,
personal_email_already_used,
)
from app.extensions import db
@ -90,7 +90,7 @@ def setting():
):
flash(f"Email {new_email} already used", "error")
new_email_valid = False
elif not email_domain_can_be_used_as_mailbox(new_email):
elif not email_can_be_used_as_mailbox(new_email):
flash(
"You cannot use this email address as your personal inbox.",
"error",