mirror of
https://github.com/zulip/zulip.git
synced 2025-11-15 19:31:58 +00:00
Call process_new_human_user consistently when creating new users.
Previously we only did this when new human users were created via the login process, which meant the management command to create a user did not add the user to default streams (for example) and any future code that might want to register a new Zulip user (such as the LDAP integration) would need to import views/__init__.py in order to properly set this up.
This commit is contained in:
@@ -250,7 +250,8 @@ def do_create_user(email, password, realm, full_name, short_name,
|
||||
active=True, bot=False, bot_owner=None,
|
||||
avatar_source=UserProfile.AVATAR_FROM_GRAVATAR,
|
||||
default_sending_stream=None, default_events_register_stream=None,
|
||||
default_all_public_streams=None):
|
||||
default_all_public_streams=None, prereg_user=None,
|
||||
newsletter_data=None):
|
||||
event = {'type': 'user_created',
|
||||
'timestamp': time.time(),
|
||||
'full_name': full_name,
|
||||
@@ -273,6 +274,9 @@ def do_create_user(email, password, realm, full_name, short_name,
|
||||
notify_created_user(user_profile)
|
||||
if bot:
|
||||
notify_created_bot(user_profile)
|
||||
else:
|
||||
process_new_human_user(user_profile, prereg_user=prereg_user,
|
||||
newsletter_data=newsletter_data)
|
||||
return user_profile
|
||||
|
||||
def user_sessions(user_profile):
|
||||
|
||||
@@ -29,7 +29,7 @@ from zerver.models import Message, UserProfile, Stream, Subscription, Huddle, \
|
||||
from zerver.lib.actions import bulk_remove_subscriptions, do_change_password, \
|
||||
do_change_full_name, do_change_enable_desktop_notifications, do_change_is_admin, \
|
||||
do_change_enter_sends, do_change_enable_sounds, do_activate_user, do_create_user, \
|
||||
process_new_human_user, do_change_subscription_property, internal_send_message, \
|
||||
do_change_subscription_property, internal_send_message, \
|
||||
create_stream_if_needed, gather_subscriptions, subscribed_to_stream, \
|
||||
update_user_presence, bulk_add_subscriptions, do_events_register, \
|
||||
get_status_dict, do_change_enable_offline_email_notifications, \
|
||||
@@ -296,12 +296,13 @@ def accounts_register(request):
|
||||
do_change_password(user_profile, password)
|
||||
do_change_full_name(user_profile, full_name)
|
||||
except UserProfile.DoesNotExist:
|
||||
user_profile = do_create_user(email, password, realm, full_name, short_name)
|
||||
user_profile = do_create_user(email, password, realm, full_name, short_name,
|
||||
prereg_user=prereg_user,
|
||||
newsletter_data={"IP": request.META['REMOTE_ADDR']})
|
||||
else:
|
||||
user_profile = do_create_user(email, password, realm, full_name, short_name)
|
||||
|
||||
process_new_human_user(user_profile, prereg_user=prereg_user,
|
||||
newsletter_data={"IP": request.META['REMOTE_ADDR']})
|
||||
user_profile = do_create_user(email, password, realm, full_name, short_name,
|
||||
prereg_user=prereg_user,
|
||||
newsletter_data={"IP": request.META['REMOTE_ADDR']})
|
||||
|
||||
# This logs you in using the ZulipDummyBackend, since honestly nothing
|
||||
# more fancy than this is required.
|
||||
@@ -1639,8 +1640,7 @@ def create_user_backend(request, user_profile, email=REQ, password=REQ,
|
||||
except UserProfile.DoesNotExist:
|
||||
pass
|
||||
|
||||
new_user_profile = do_create_user(email, password, realm, full_name, short_name)
|
||||
process_new_human_user(new_user_profile)
|
||||
do_create_user(email, password, realm, full_name, short_name)
|
||||
return json_success()
|
||||
|
||||
@authenticated_json_post_view
|
||||
|
||||
Reference in New Issue
Block a user