mirror of
https://github.com/zulip/zulip.git
synced 2025-11-14 10:57:58 +00:00
Use standard functions for parsing/validating email addresses.
This adds two new functions for parsing out the domain and username
from an email address, and switches our backend to use them and
django.core.validators.valid_email() rather than custom parsing and
raw email.split("@").
(imported from commit 3d6e997d66908811eccb5f82f2f7fe349b40f238)
This commit is contained in:
@@ -2,7 +2,7 @@ from __future__ import absolute_import
|
||||
|
||||
from zephyr.lib.initial_password import initial_password
|
||||
from zephyr.models import Realm, Stream, UserProfile, Huddle, \
|
||||
Subscription, Recipient, Client, get_huddle_hash
|
||||
Subscription, Recipient, Client, get_huddle_hash, email_to_domain
|
||||
from zephyr.lib.create_user import create_user_profile
|
||||
|
||||
def bulk_create_realms(realm_list):
|
||||
@@ -31,7 +31,7 @@ def bulk_create_users(realms, users_raw):
|
||||
# Now create user_profiles
|
||||
profiles_to_create = []
|
||||
for (email, full_name, short_name, active) in users:
|
||||
domain = email.split('@')[1]
|
||||
domain = email_to_domain(email)
|
||||
profile = create_user_profile(realms[domain], email,
|
||||
initial_password(email), active, False,
|
||||
full_name, short_name, None)
|
||||
|
||||
Reference in New Issue
Block a user