def create_user_profile(realm, email, password, active, bot_type, full_name, short_name, bot_owner, is_mirror_dummy): # type: (Realm, text_type, text_type, bool, Optional[int], text_type, text_type, Optional[UserProfile], bool) -> UserProfile now = timezone.now() email = UserManager.normalize_email(email) enable_stream_desktop_notifications = (realm.domain != 'zulip.com') user_profile = UserProfile(email=email, is_staff=False, is_active=active, full_name=full_name, short_name=short_name, last_login=now, date_joined=now, realm=realm, pointer=-1, is_bot=bool(bot_type), bot_type=bot_type, is_mirror_dummy=is_mirror_dummy, enable_stream_desktop_notifications=enable_stream_desktop_notifications, onboarding_steps=ujson.dumps([])) if bot_owner is not None: # `user_profile.bot_owner = bot_owner` doesn't work on python 3.4 user_profile.bot_owner_id = bot_owner.id if bot_type or not active: password = None user_profile.set_password(password) user_profile.api_key = random_api_key() return user_profile
def create_user_profile(realm, email, password, active, bot_type, full_name, short_name, bot_owner, is_mirror_dummy, tos_version): # type: (Realm, text_type, text_type, bool, Optional[int], text_type, text_type, Optional[UserProfile], bool, Optional[text_type]) -> UserProfile now = timezone.now() email = UserManager.normalize_email(email) enable_stream_desktop_notifications = (realm.domain != 'zulip.com') user_profile = UserProfile(email=email, is_staff=False, is_active=active, full_name=full_name, short_name=short_name, last_login=now, date_joined=now, realm=realm, pointer=-1, is_bot=bool(bot_type), bot_type=bot_type, is_mirror_dummy=is_mirror_dummy, tos_version=tos_version, enable_stream_desktop_notifications=enable_stream_desktop_notifications, onboarding_steps=ujson.dumps([]), default_language=realm.default_language) if bot_owner is not None: # `user_profile.bot_owner = bot_owner` doesn't work on python 3.4 user_profile.bot_owner_id = bot_owner.id if bot_type or not active: password = None user_profile.set_password(password) user_profile.api_key = random_api_key() return user_profile
def create_user_profile(realm, email, password, active, bot_type, full_name, short_name, bot_owner, is_mirror_dummy, tos_version): # type: (Realm, Text, Text, bool, Optional[int], Text, Text, Optional[UserProfile], bool, Optional[Text]) -> UserProfile now = timezone.now() email = UserManager.normalize_email(email) user_profile = UserProfile(email=email, is_staff=False, is_active=active, full_name=full_name, short_name=short_name, last_login=now, date_joined=now, realm=realm, pointer=-1, is_bot=bool(bot_type), bot_type=bot_type, is_mirror_dummy=is_mirror_dummy, tos_version=tos_version, onboarding_steps=ujson.dumps([]), default_language=realm.default_language) if bot_owner is not None: # `user_profile.bot_owner = bot_owner` doesn't work on python 3.4 user_profile.bot_owner_id = bot_owner.id if bot_type or not active: password = None user_profile.set_password(password) user_profile.api_key = random_api_key() return user_profile