Terms of Service: Fix corner cases around new users being created.

This fixes a few bugs in 7910a6e134,
related to automatically created user accounts.
This commit is contained in:
Rishi Gupta
2016-08-09 18:05:26 -07:00
committed by Tim Abbott
parent 3bae3cd54d
commit 708b416ca1
7 changed files with 19 additions and 17 deletions

View File

@@ -18,8 +18,8 @@ def bulk_create_realms(realm_list):
existing_realms.add(domain)
Realm.objects.bulk_create(realms_to_create)
def bulk_create_users(realms, users_raw, bot_type=None):
# type: (Mapping[text_type, Realm], Set[Tuple[text_type, text_type, text_type, bool]], Optional[int]) -> None
def bulk_create_users(realms, users_raw, bot_type=None, tos_version=None):
# type: (Mapping[text_type, Realm], Set[Tuple[text_type, text_type, text_type, bool]], Optional[int], Optional[text_type]) -> None
"""
Creates and saves a UserProfile with the given email.
Has some code based off of UserManage.create_user, but doesn't .save()
@@ -39,7 +39,7 @@ def bulk_create_users(realms, users_raw, bot_type=None):
domain = resolve_email_to_domain(email)
profile = create_user_profile(realms[domain], email,
initial_password(email), active, bot_type,
full_name, short_name, None, False)
full_name, short_name, None, False, tos_version)
profiles_to_create.append(profile)
UserProfile.objects.bulk_create(profiles_to_create)