mirror of https://github.com/zulip/zulip.git
email_validation: Rename to validate_is_not_disposable.
This clarifies what we are asserting -- namely, that the email is _not_ disposable.
This commit is contained in:
parent
c1aadbe52e
commit
4b512b3409
|
@ -17,7 +17,7 @@ from zerver.models.realms import (
|
|||
from zerver.models.users import get_users_by_delivery_email, is_cross_realm_bot_email
|
||||
|
||||
|
||||
def validate_disposable(email: str) -> None:
|
||||
def validate_is_not_disposable(email: str) -> None:
|
||||
if is_disposable_domain(Address(addr_spec=email).domain):
|
||||
raise DisposableEmailError
|
||||
|
||||
|
@ -26,7 +26,7 @@ def get_realm_email_validator(realm: Realm) -> Callable[[str], None]:
|
|||
if not realm.emails_restricted_to_domains:
|
||||
# Should we also do '+' check for non-restricted realms?
|
||||
if realm.disallow_disposable_email_addresses:
|
||||
return validate_disposable
|
||||
return validate_is_not_disposable
|
||||
|
||||
# allow any email through
|
||||
return lambda email: None
|
||||
|
|
|
@ -38,7 +38,7 @@ from corporate.models import (
|
|||
get_customer_by_remote_realm,
|
||||
)
|
||||
from zerver.decorator import require_post
|
||||
from zerver.lib.email_validation import validate_disposable
|
||||
from zerver.lib.email_validation import validate_is_not_disposable
|
||||
from zerver.lib.exceptions import (
|
||||
ErrorCode,
|
||||
JsonableError,
|
||||
|
@ -143,7 +143,7 @@ def register_remote_server(
|
|||
|
||||
# We don't want to allow disposable domains for contact_email either
|
||||
try:
|
||||
validate_disposable(contact_email)
|
||||
validate_is_not_disposable(contact_email)
|
||||
except DisposableEmailError:
|
||||
raise JsonableError(_("Please use your real email address."))
|
||||
|
||||
|
|
Loading…
Reference in New Issue