mirror of
				https://github.com/zulip/zulip.git
				synced 2025-10-31 03:53:50 +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:
		| @@ -180,6 +180,11 @@ class RegistrationForm(RealmDetailsForm): | ||||
|     ) | ||||
|  | ||||
|     def __init__(self, *args: Any, **kwargs: Any) -> None: | ||||
|         # Since the superclass doesn't except random extra kwargs, we | ||||
|         # remove it from the kwargs dict before initializing. | ||||
|         self.realm_creation = kwargs["realm_creation"] | ||||
|         self.realm = kwargs.pop("realm", None) | ||||
|  | ||||
|         super().__init__(*args, **kwargs) | ||||
|         if settings.TERMS_OF_SERVICE_VERSION is not None: | ||||
|             self.fields["terms"] = forms.BooleanField(required=True) | ||||
| @@ -211,7 +216,9 @@ class RegistrationForm(RealmDetailsForm): | ||||
|  | ||||
|     def clean_full_name(self) -> str: | ||||
|         try: | ||||
|             return check_full_name(self.cleaned_data["full_name"]) | ||||
|             return check_full_name( | ||||
|                 full_name_raw=self.cleaned_data["full_name"], user_profile=None, realm=self.realm | ||||
|             ) | ||||
|         except JsonableError as e: | ||||
|             raise ValidationError(e.msg) | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user