Commit 870e15110af9b433c2836350f39c9f4f3f4984cb
1 parent
83dc32cc
Exists in
spb-release/3.0
and in
2 other branches
Fix wrong validation messages.
Signed-off-by: Gustavo Jaruga <darksshades@gmail.com> (cherry picked from commit 954b3abfe81394e276a822b9615d0eae69239c84)
Showing
4 changed files
with
11 additions
and
11 deletions
Show diff stats
colab/accounts/forms.py
@@ -198,12 +198,10 @@ class UserCreationForm(UserForm): | @@ -198,12 +198,10 @@ class UserCreationForm(UserForm): | ||
198 | username = forms.RegexField(label=_("Username"), max_length=30, | 198 | username = forms.RegexField(label=_("Username"), max_length=30, |
199 | regex=r'^[\w.@+-]+$', | 199 | regex=r'^[\w.@+-]+$', |
200 | help_text=_(("Required. 30 characters or fewer" | 200 | help_text=_(("Required. 30 characters or fewer" |
201 | - ". Letters, digits and " | ||
202 | - "@/./+/-/_ only.")), | 201 | + ". Letter and digits.")), |
203 | error_messages={ | 202 | error_messages={ |
204 | 'invalid': _(("This value may contain only" | 203 | 'invalid': _(("This value may contain only" |
205 | - " letters, numbers and " | ||
206 | - "@/./+/-/_ characters."))}) | 204 | + " letters and numbers."))}) |
207 | password1 = forms.CharField(label=_("Password"), | 205 | password1 = forms.CharField(label=_("Password"), |
208 | widget=forms.PasswordInput) | 206 | widget=forms.PasswordInput) |
209 | password2 = forms.CharField(label=_("Password confirmation"), | 207 | password2 = forms.CharField(label=_("Password confirmation"), |
@@ -252,12 +250,10 @@ class UserCreationForm(UserForm): | @@ -252,12 +250,10 @@ class UserCreationForm(UserForm): | ||
252 | 250 | ||
253 | class UserChangeForm(forms.ModelForm): | 251 | class UserChangeForm(forms.ModelForm): |
254 | username = forms.RegexField( | 252 | username = forms.RegexField( |
255 | - label=_("Username"), max_length=30, regex=r"^[\w.@+-]+$", | ||
256 | - help_text=_("Required. 30 characters or fewer. Letters, digits and " | ||
257 | - "@/./+/-/_ only."), | 253 | + label=_("Username"), max_length=30, regex=r"^[\w*]", |
254 | + help_text=_("Required. 30 characters or fewer. Letters and digits."), | ||
258 | error_messages={ | 255 | error_messages={ |
259 | - 'invalid': _("This value may contain only letters, numbers and " | ||
260 | - "@/./+/-/_ characters.")}) | 256 | + 'invalid': _("This value may contain only letters and numbers.")}) |
261 | password = ReadOnlyPasswordHashField(label=_("Password"), | 257 | password = ReadOnlyPasswordHashField(label=_("Password"), |
262 | help_text=_("Raw passwords are not" | 258 | help_text=_("Raw passwords are not" |
263 | " stored, so there is no" | 259 | " 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 |