Commit 16a5527fbb720a9d69e243946c285b94e41aa00f
Committed by
Lucas Kanashiro
1 parent
b3a5c551
Exists in
master
and in
8 other branches
Changed regex for user creation and alter
Signed-off-by: Lucas Moura <lucas.moura128@gmail.com> Signed-off-by: Matheus Faria <matheus.sousa.faria@gmail.com>
Showing
2 changed files
with
4 additions
and
4 deletions
Show diff stats
colab/accounts/forms.py
@@ -181,7 +181,7 @@ class UserCreationForm(UserForm): | @@ -181,7 +181,7 @@ class UserCreationForm(UserForm): | ||
181 | 'password_mismatch': _("The two password fields didn't match."), | 181 | 'password_mismatch': _("The two password fields didn't match."), |
182 | } | 182 | } |
183 | username = forms.RegexField(label=_("Username"), max_length=30, | 183 | username = forms.RegexField(label=_("Username"), max_length=30, |
184 | - regex=r'^[\w.@+-]+$', | 184 | + regex=r'^[\w]+$', |
185 | help_text=_(("Required. 30 characters or fewer" | 185 | help_text=_(("Required. 30 characters or fewer" |
186 | ". Letter and digits.")), | 186 | ". Letter and digits.")), |
187 | error_messages={ | 187 | error_messages={ |
@@ -251,7 +251,7 @@ class UserCreationForm(UserForm): | @@ -251,7 +251,7 @@ class UserCreationForm(UserForm): | ||
251 | 251 | ||
252 | class UserChangeForm(forms.ModelForm): | 252 | class UserChangeForm(forms.ModelForm): |
253 | username = forms.RegexField( | 253 | username = forms.RegexField( |
254 | - label=_("Username"), max_length=30, regex=r'^[\w.@+-]+$', | 254 | + label=_("Username"), max_length=30, regex=r'^[\w]+$', |
255 | help_text=_("Required. 30 characters or fewer. Letters and digits."), | 255 | help_text=_("Required. 30 characters or fewer. Letters and digits."), |
256 | error_messages={ | 256 | error_messages={ |
257 | 'invalid': _("This value may contain only letters and numbers.")}) | 257 | 'invalid': _("This value may contain only letters and numbers.")}) |
colab/accounts/tests/test_forms.py
@@ -64,7 +64,7 @@ class FormTest(TestCase): | @@ -64,7 +64,7 @@ class FormTest(TestCase): | ||
64 | 64 | ||
65 | def test_valid_username(self): | 65 | def test_valid_username(self): |
66 | form = self.create_form_data('user@email.com', | 66 | form = self.create_form_data('user@email.com', |
67 | - 'colab123@colab-spb.com') | 67 | + 'colab123') |
68 | self.assertTrue(form.is_valid()) | 68 | self.assertTrue(form.is_valid()) |
69 | 69 | ||
70 | def test_not_valid_username(self): | 70 | def test_not_valid_username(self): |
@@ -73,7 +73,7 @@ class FormTest(TestCase): | @@ -73,7 +73,7 @@ class FormTest(TestCase): | ||
73 | self.assertFalse(form.is_valid()) | 73 | self.assertFalse(form.is_valid()) |
74 | 74 | ||
75 | def test_update_valid_username(self): | 75 | def test_update_valid_username(self): |
76 | - form = self.create_change_form_data('colab123@colab-spb.com') | 76 | + form = self.create_change_form_data('colab123') |
77 | self.assertTrue(form.is_valid()) | 77 | self.assertTrue(form.is_valid()) |
78 | 78 | ||
79 | def test_update_not_valid_username(self): | 79 | def test_update_not_valid_username(self): |