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:
Alex Vandiver
2024-02-27 15:14:43 +00:00
committed by Tim Abbott
parent c1aadbe52e
commit 4b512b3409
2 changed files with 4 additions and 4 deletions

View File

@@ -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