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.

create_user: Specify tos_version=None explicitly in automation.

Tim Abbottfddd83394ec4
diff --git a/zerver/management/commands/create_user.py b/zerver/management/commands/create_user.py
index cc588d500de..9abb9dc2928 100644
--- a/zerver/management/commands/create_user.py
+++ b/zerver/management/commands/create_user.py
@@ -74,6 +74,11 @@ parameters, or specify no parameters for interactive user creation."""
pw,
realm,
full_name,
+ # Explicitly set tos_version=None. For servers that
+ # have configured Terms of Service, this means that
+ # users created via this mechanism will be prompted to
+ # accept the Terms of Service on first login.
+ tos_version=None,
acting_user=None,
)
except IntegrityError:
diff --git a/zerver/views/users.py b/zerver/views/users.py
index 9e33dd45585..eafd5908d50 100644
--- a/zerver/views/users.py
+++ b/zerver/views/users.py
@@ -641,7 +641,18 @@ def create_user_backend(
if not check_password_strength(password):
raise JsonableError(PASSWORD_TOO_WEAK_ERROR)
- target_user = do_create_user(email, password, realm, full_name, acting_user=user_profile)
+ target_user = do_create_user(
+ email,
+ password,
+ realm,
+ full_name,
+ # Explicitly set tos_version=None. For servers that have
+ # configured Terms of Service, this means that users created
+ # via this mechanism will be prompted to accept the Terms of
+ # Service on first login.
+ tos_version=None,
+ acting_user=user_profile,
+ )
return json_success(request, data={"user_id": target_user.id})