Commit febec9ac1475b1c8be7e6aae86e51d527b3c6dfc
Exists in
master
and in
32 other branches
Merge branch 'Validation_colab_sprint_30' into 'master'
Validation colab sprint 30 See merge request !54
Showing
4 changed files
with
11 additions
and
11 deletions
Show diff stats
colab/accounts/forms.py
@@ -203,12 +203,10 @@ class UserCreationForm(UserForm): | @@ -203,12 +203,10 @@ class UserCreationForm(UserForm): | ||
203 | username = forms.RegexField(label=_("Username"), max_length=30, | 203 | username = forms.RegexField(label=_("Username"), max_length=30, |
204 | regex=r'^[\w.@+-]+$', | 204 | regex=r'^[\w.@+-]+$', |
205 | help_text=_(("Required. 30 characters or fewer" | 205 | help_text=_(("Required. 30 characters or fewer" |
206 | - ". Letters, digits and " | ||
207 | - "@/./+/-/_ only.")), | 206 | + ". Letter and digits.")), |
208 | error_messages={ | 207 | error_messages={ |
209 | 'invalid': _(("This value may contain only" | 208 | 'invalid': _(("This value may contain only" |
210 | - " letters, numbers and " | ||
211 | - "@/./+/-/_ characters."))}) | 209 | + " letters and numbers."))}) |
212 | password1 = forms.CharField(label=_("Password"), | 210 | password1 = forms.CharField(label=_("Password"), |
213 | widget=forms.PasswordInput) | 211 | widget=forms.PasswordInput) |
214 | password2 = forms.CharField(label=_("Password confirmation"), | 212 | password2 = forms.CharField(label=_("Password confirmation"), |
@@ -272,12 +270,10 @@ class UserCreationForm(UserForm): | @@ -272,12 +270,10 @@ class UserCreationForm(UserForm): | ||
272 | 270 | ||
273 | class UserChangeForm(forms.ModelForm): | 271 | class UserChangeForm(forms.ModelForm): |
274 | username = forms.RegexField( | 272 | username = forms.RegexField( |
275 | - label=_("Username"), max_length=30, regex=r"^[\w.@+-]+$", | ||
276 | - help_text=_("Required. 30 characters or fewer. Letters, digits and " | ||
277 | - "@/./+/-/_ only."), | 273 | + label=_("Username"), max_length=30, regex=r"^[\w*]", |
274 | + help_text=_("Required. 30 characters or fewer. Letters and digits."), | ||
278 | error_messages={ | 275 | error_messages={ |
279 | - 'invalid': _("This value may contain only letters, numbers and " | ||
280 | - "@/./+/-/_ characters.")}) | 276 | + 'invalid': _("This value may contain only letters and numbers.")}) |
281 | password = ReadOnlyPasswordHashField(label=_("Password"), | 277 | password = ReadOnlyPasswordHashField(label=_("Password"), |
282 | help_text=_("Raw passwords are not" | 278 | help_text=_("Raw passwords are not" |
283 | " stored, so there is no" | 279 | " stored, so there is no" |
colab/accounts/models.py
@@ -82,8 +82,7 @@ class User(AbstractUser): | @@ -82,8 +82,7 @@ class User(AbstractUser): | ||
82 | # without having to rewrite all AbstractUser here | 82 | # without having to rewrite all AbstractUser here |
83 | User._meta.get_field('email')._unique = True | 83 | User._meta.get_field('email')._unique = True |
84 | User._meta.get_field('username').help_text = _( | 84 | User._meta.get_field('username').help_text = _( |
85 | - u'Required. 30 characters or fewer. Letters, digits and ' | ||
86 | - u'./+/-/_ only.' | 85 | + u'Required. 30 characters or fewer. Letters and digits.' |
87 | ) | 86 | ) |
88 | User._meta.get_field('username').validators[0] = validators.RegexValidator( | 87 | User._meta.get_field('username').validators[0] = validators.RegexValidator( |
89 | r'^\w+$', | 88 | r'^\w+$', |
colab/locale/pt_BR/LC_MESSAGES/django.mo
No preview for this file type
colab/locale/pt_BR/LC_MESSAGES/django.po
@@ -1281,6 +1281,11 @@ msgstr "" | @@ -1281,6 +1281,11 @@ msgstr "" | ||
1281 | "Outro exemplo de uso com relacionamento. Usado para recuperar todos as " | 1281 | "Outro exemplo de uso com relacionamento. Usado para recuperar todos as " |
1282 | "mensagem de um dado usuário usando o campo username ou email" | 1282 | "mensagem de um dado usuário usando o campo username ou email" |
1283 | 1283 | ||
1284 | + | ||
1285 | +#: colab/accounts/forms.py:276 | ||
1286 | +msgid "This value may contain only letters and numbers." | ||
1287 | +msgstr "Esse campo só pode conter letras e/ou numeros." | ||
1288 | + | ||
1284 | #~ msgid "Please correct the errors below and try again" | 1289 | #~ msgid "Please correct the errors below and try again" |
1285 | #~ msgstr "Por favor, corrija os erros abaixo e tente novamente" | 1290 | #~ msgstr "Por favor, corrija os erros abaixo e tente novamente" |
1286 | 1291 |