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 | 181 | 'password_mismatch': _("The two password fields didn't match."), |
182 | 182 | } |
183 | 183 | username = forms.RegexField(label=_("Username"), max_length=30, |
184 | - regex=r'^[\w.@+-]+$', | |
184 | + regex=r'^[\w]+$', | |
185 | 185 | help_text=_(("Required. 30 characters or fewer" |
186 | 186 | ". Letter and digits.")), |
187 | 187 | error_messages={ |
... | ... | @@ -251,7 +251,7 @@ class UserCreationForm(UserForm): |
251 | 251 | |
252 | 252 | class UserChangeForm(forms.ModelForm): |
253 | 253 | username = forms.RegexField( |
254 | - label=_("Username"), max_length=30, regex=r'^[\w.@+-]+$', | |
254 | + label=_("Username"), max_length=30, regex=r'^[\w]+$', | |
255 | 255 | help_text=_("Required. 30 characters or fewer. Letters and digits."), |
256 | 256 | error_messages={ |
257 | 257 | 'invalid': _("This value may contain only letters and numbers.")}) | ... | ... |
colab/accounts/tests/test_forms.py
... | ... | @@ -64,7 +64,7 @@ class FormTest(TestCase): |
64 | 64 | |
65 | 65 | def test_valid_username(self): |
66 | 66 | form = self.create_form_data('user@email.com', |
67 | - 'colab123@colab-spb.com') | |
67 | + 'colab123') | |
68 | 68 | self.assertTrue(form.is_valid()) |
69 | 69 | |
70 | 70 | def test_not_valid_username(self): |
... | ... | @@ -73,7 +73,7 @@ class FormTest(TestCase): |
73 | 73 | self.assertFalse(form.is_valid()) |
74 | 74 | |
75 | 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 | 77 | self.assertTrue(form.is_valid()) |
78 | 78 | |
79 | 79 | def test_update_not_valid_username(self): | ... | ... |