Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

email_validation: Restore case-insensitive domain validation.

Anders Kaseorgc5c180fda38b
diff --git a/zerver/lib/email_validation.py b/zerver/lib/email_validation.py
index 0a905b8a1d4..70479a4b7da 100644
--- a/zerver/lib/email_validation.py
+++ b/zerver/lib/email_validation.py
@@ -62,7 +62,7 @@ def get_realm_email_validator(realm: Realm) -> Callable[[str], None]:
if "+" in address.username:
raise EmailContainsPlusError
- domain = address.domain
+ domain = address.domain.lower()
if domain in allowed_domains:
return
diff --git a/zerver/views/message_send.py b/zerver/views/message_send.py
index 526654a3986..548a7d8811b 100644
--- a/zerver/views/message_send.py
+++ b/zerver/views/message_send.py
@@ -97,7 +97,7 @@ def same_realm_zephyr_user(user_profile: UserProfile, email: str) -> bool:
except ValidationError:
return False
- domain = Address(addr_spec=email).domain
+ domain = Address(addr_spec=email).domain.lower()
# Assumes allow_subdomains=False for all RealmDomain's corresponding to
# these realms.
@@ -116,7 +116,7 @@ def same_realm_irc_user(user_profile: UserProfile, email: str) -> bool:
except ValidationError:
return False
- domain = Address(addr_spec=email).domain
+ domain = Address(addr_spec=email).domain.lower()
if domain.startswith("irc."):
domain = domain[len("irc.") :]
@@ -133,7 +133,7 @@ def same_realm_jabber_user(user_profile: UserProfile, email: str) -> bool:
# If your Jabber users have a different email domain than the
# Zulip users, this is where you would do any translation.
- domain = Address(addr_spec=email).domain
+ domain = Address(addr_spec=email).domain.lower()
# Assumes allow_subdomains=False for all RealmDomain's corresponding to
# these realms.