rename email_domain_can_be_used_as_mailbox -> email_can_be_used_as_mailbox
This commit is contained in:
parent
f56b0cddb2
commit
90163220cf
|
@ -12,7 +12,7 @@ from app.api.base import api_bp
|
||||||
from app.config import FLASK_SECRET, DISABLE_REGISTRATION
|
from app.config import FLASK_SECRET, DISABLE_REGISTRATION
|
||||||
from app.dashboard.views.setting import send_reset_password_email
|
from app.dashboard.views.setting import send_reset_password_email
|
||||||
from app.email_utils import (
|
from app.email_utils import (
|
||||||
email_domain_can_be_used_as_mailbox,
|
email_can_be_used_as_mailbox,
|
||||||
personal_email_already_used,
|
personal_email_already_used,
|
||||||
send_email,
|
send_email,
|
||||||
render,
|
render,
|
||||||
|
@ -89,9 +89,7 @@ def auth_register():
|
||||||
|
|
||||||
if DISABLE_REGISTRATION:
|
if DISABLE_REGISTRATION:
|
||||||
return jsonify(error="registration is closed"), 400
|
return jsonify(error="registration is closed"), 400
|
||||||
if not email_domain_can_be_used_as_mailbox(email) or personal_email_already_used(
|
if not email_can_be_used_as_mailbox(email) or personal_email_already_used(email):
|
||||||
email
|
|
||||||
):
|
|
||||||
return jsonify(error=f"cannot use {email} as personal inbox"), 400
|
return jsonify(error=f"cannot use {email} as personal inbox"), 400
|
||||||
|
|
||||||
if not password or len(password) < 8:
|
if not password or len(password) < 8:
|
||||||
|
@ -249,9 +247,9 @@ def auth_facebook():
|
||||||
if not user:
|
if not user:
|
||||||
if DISABLE_REGISTRATION:
|
if DISABLE_REGISTRATION:
|
||||||
return jsonify(error="registration is closed"), 400
|
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
|
email
|
||||||
) or personal_email_already_used(email):
|
):
|
||||||
return jsonify(error=f"cannot use {email} as personal inbox"), 400
|
return jsonify(error=f"cannot use {email} as personal inbox"), 400
|
||||||
|
|
||||||
LOG.d("create facebook user with %s", user_info)
|
LOG.d("create facebook user with %s", user_info)
|
||||||
|
@ -302,9 +300,9 @@ def auth_google():
|
||||||
if not user:
|
if not user:
|
||||||
if DISABLE_REGISTRATION:
|
if DISABLE_REGISTRATION:
|
||||||
return jsonify(error="registration is closed"), 400
|
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
|
email
|
||||||
) or personal_email_already_used(email):
|
):
|
||||||
return jsonify(error=f"cannot use {email} as personal inbox"), 400
|
return jsonify(error=f"cannot use {email} as personal inbox"), 400
|
||||||
|
|
||||||
LOG.d("create Google user with %s", user_info)
|
LOG.d("create Google user with %s", user_info)
|
||||||
|
|
|
@ -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.dashboard.views.mailbox_detail import verify_mailbox_change
|
||||||
from app.email_utils import (
|
from app.email_utils import (
|
||||||
mailbox_already_used,
|
mailbox_already_used,
|
||||||
email_domain_can_be_used_as_mailbox,
|
email_can_be_used_as_mailbox,
|
||||||
)
|
)
|
||||||
from app.extensions import db
|
from app.extensions import db
|
||||||
from app.models import Mailbox
|
from app.models import Mailbox
|
||||||
|
@ -34,7 +34,7 @@ def create_mailbox():
|
||||||
|
|
||||||
if mailbox_already_used(mailbox_email, user):
|
if mailbox_already_used(mailbox_email, user):
|
||||||
return jsonify(error=f"{mailbox_email} already used"), 400
|
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 (
|
return (
|
||||||
jsonify(
|
jsonify(
|
||||||
error=f"{mailbox_email} cannot be used. Please note a mailbox cannot "
|
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):
|
if mailbox_already_used(new_email, user):
|
||||||
return jsonify(error=f"{new_email} already used"), 400
|
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 (
|
return (
|
||||||
jsonify(
|
jsonify(
|
||||||
error=f"{new_email} cannot be used. Please note a mailbox cannot "
|
error=f"{new_email} cannot be used. Please note a mailbox cannot "
|
||||||
|
|
|
@ -9,7 +9,7 @@ from app.auth.base import auth_bp
|
||||||
from app.auth.views.login_utils import get_referral
|
from app.auth.views.login_utils import get_referral
|
||||||
from app.config import URL, HCAPTCHA_SECRET, HCAPTCHA_SITEKEY
|
from app.config import URL, HCAPTCHA_SECRET, HCAPTCHA_SITEKEY
|
||||||
from app.email_utils import (
|
from app.email_utils import (
|
||||||
email_domain_can_be_used_as_mailbox,
|
email_can_be_used_as_mailbox,
|
||||||
personal_email_already_used,
|
personal_email_already_used,
|
||||||
)
|
)
|
||||||
from app.extensions import db
|
from app.extensions import db
|
||||||
|
@ -67,7 +67,7 @@ def register():
|
||||||
)
|
)
|
||||||
|
|
||||||
email = form.email.data.strip().lower()
|
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")
|
flash("You cannot use this email address as your personal inbox.", "error")
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -8,7 +8,7 @@ from wtforms.fields.html5 import EmailField
|
||||||
from app.config import EMAIL_DOMAIN, ALIAS_DOMAINS, MAILBOX_SECRET, URL
|
from app.config import EMAIL_DOMAIN, ALIAS_DOMAINS, MAILBOX_SECRET, URL
|
||||||
from app.dashboard.base import dashboard_bp
|
from app.dashboard.base import dashboard_bp
|
||||||
from app.email_utils import (
|
from app.email_utils import (
|
||||||
email_domain_can_be_used_as_mailbox,
|
email_can_be_used_as_mailbox,
|
||||||
mailbox_already_used,
|
mailbox_already_used,
|
||||||
render,
|
render,
|
||||||
send_email,
|
send_email,
|
||||||
|
@ -88,7 +88,7 @@ def mailbox_route():
|
||||||
|
|
||||||
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")
|
||||||
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")
|
flash(f"You cannot use {mailbox_email}.", "error")
|
||||||
else:
|
else:
|
||||||
new_mailbox = Mailbox.create(
|
new_mailbox = Mailbox.create(
|
||||||
|
|
|
@ -10,7 +10,7 @@ from wtforms.fields.html5 import EmailField
|
||||||
from app.config import ENFORCE_SPF, MAILBOX_SECRET
|
from app.config import ENFORCE_SPF, MAILBOX_SECRET
|
||||||
from app.config import URL
|
from app.config import URL
|
||||||
from app.dashboard.base import dashboard_bp
|
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.email_utils import mailbox_already_used, render, send_email
|
||||||
from app.extensions import db
|
from app.extensions import db
|
||||||
from app.log import LOG
|
from app.log import LOG
|
||||||
|
@ -52,7 +52,7 @@ def mailbox_detail_route(mailbox_id):
|
||||||
email=new_email
|
email=new_email
|
||||||
):
|
):
|
||||||
flash(f"Email {new_email} already used", "error")
|
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")
|
flash("You cannot use this email address as your mailbox", "error")
|
||||||
else:
|
else:
|
||||||
mailbox.new_email = new_email
|
mailbox.new_email = new_email
|
||||||
|
|
|
@ -22,7 +22,7 @@ from app import s3, email_utils
|
||||||
from app.config import URL, FIRST_ALIAS_DOMAIN
|
from app.config import URL, FIRST_ALIAS_DOMAIN
|
||||||
from app.dashboard.base import dashboard_bp
|
from app.dashboard.base import dashboard_bp
|
||||||
from app.email_utils import (
|
from app.email_utils import (
|
||||||
email_domain_can_be_used_as_mailbox,
|
email_can_be_used_as_mailbox,
|
||||||
personal_email_already_used,
|
personal_email_already_used,
|
||||||
)
|
)
|
||||||
from app.extensions import db
|
from app.extensions import db
|
||||||
|
@ -90,7 +90,7 @@ def setting():
|
||||||
):
|
):
|
||||||
flash(f"Email {new_email} already used", "error")
|
flash(f"Email {new_email} already used", "error")
|
||||||
new_email_valid = False
|
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(
|
flash(
|
||||||
"You cannot use this email address as your personal inbox.",
|
"You cannot use this email address as your personal inbox.",
|
||||||
"error",
|
"error",
|
||||||
|
|
Loading…
Reference in a new issue