mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 04:53:36 +00:00
settings: Add permission to enforce unique names in realm.
Previously, users were allowed to signup or change their names to those which already existed in the realm. This commit adds an Organization Permission, that shall enforce users to use unique names while signing up or changing their names. If a same or normalized full name is found in realm, then a validation error is thrown. Fixes #7830.
This commit is contained in:
@@ -2421,6 +2421,25 @@ class UserSignUpTest(ZulipTestCase):
|
||||
# Verify that the user is asked for name and password
|
||||
self.assert_in_success_response(["id_password", "id_full_name"], result)
|
||||
|
||||
def test_signup_with_existing_name(self) -> None:
|
||||
"""
|
||||
Check if signing up with an existing name when organization
|
||||
has set "Require Unique Names"is handled properly.
|
||||
"""
|
||||
|
||||
iago = self.example_user("iago")
|
||||
email = "newguy@zulip.com"
|
||||
password = "newpassword"
|
||||
|
||||
do_set_realm_property(iago.realm, "require_unique_names", True, acting_user=None)
|
||||
result = self.verify_signup(email=email, password=password, full_name="IaGo")
|
||||
assert not isinstance(result, UserProfile)
|
||||
self.assert_in_success_response(["Unique names required in this organization."], result)
|
||||
|
||||
do_set_realm_property(iago.realm, "require_unique_names", False, acting_user=None)
|
||||
result = self.verify_signup(email=email, password=password, full_name="IaGo")
|
||||
assert isinstance(result, UserProfile)
|
||||
|
||||
def test_signup_without_password(self) -> None:
|
||||
"""
|
||||
Check if signing up without a password works properly when
|
||||
|
||||
Reference in New Issue
Block a user