Commit febec9ac1475b1c8be7e6aae86e51d527b3c6dfc

Authored by Alexandre Barbosa
2 parents 9e24daab 954b3abf

Merge branch 'Validation_colab_sprint_30' into 'master'

Validation colab sprint 30

See merge request !54
colab/accounts/forms.py
... ... @@ -203,12 +203,10 @@ class UserCreationForm(UserForm):
203 203 username = forms.RegexField(label=_("Username"), max_length=30,
204 204 regex=r'^[\w.@+-]+$',
205 205 help_text=_(("Required. 30 characters or fewer"
206   - ". Letters, digits and "
207   - "@/./+/-/_ only.")),
  206 + ". Letter and digits.")),
208 207 error_messages={
209 208 'invalid': _(("This value may contain only"
210   - " letters, numbers and "
211   - "@/./+/-/_ characters."))})
  209 + " letters and numbers."))})
212 210 password1 = forms.CharField(label=_("Password"),
213 211 widget=forms.PasswordInput)
214 212 password2 = forms.CharField(label=_("Password confirmation"),
... ... @@ -272,12 +270,10 @@ class UserCreationForm(UserForm):
272 270  
273 271 class UserChangeForm(forms.ModelForm):
274 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 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 277 password = ReadOnlyPasswordHashField(label=_("Password"),
282 278 help_text=_("Raw passwords are not"
283 279 " stored, so there is no"
... ...
colab/accounts/models.py
... ... @@ -82,8 +82,7 @@ class User(AbstractUser):
82 82 # without having to rewrite all AbstractUser here
83 83 User._meta.get_field('email')._unique = True
84 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 87 User._meta.get_field('username').validators[0] = validators.RegexValidator(
89 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 1281 "Outro exemplo de uso com relacionamento. Usado para recuperar todos as "
1282 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 1289 #~ msgid "Please correct the errors below and try again"
1285 1290 #~ msgstr "Por favor, corrija os erros abaixo e tente novamente"
1286 1291  
... ...