Password validation Error with Latin characters

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Password validation Error with Latin characters

Adrian Mansilla

I am using the function 'validate_password (password, new_user)' and I have my settings configured in Spanish, the problem comes when the validate_password function raises an error with the word 'contraseña' and shows me this error:
ValidationError: [u'La contrase\xf1a es demasiado similar a la de nombre de usuario.']
I am using python 2.7 and Django 1.11.4

This is the traceback:

Traceback (most recent call last):
  File "/Users/adrianmansilla/Documents/sisgos/venv/lib/python2.7/site-packages/django/core/handlers/exception.py", line 41, in inner
    response = get_response(request)
  File "/Users/adrianmansilla/Documents/sisgos/venv/lib/python2.7/site-packages/django/core/handlers/base.py", line 187, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "/Users/adrianmansilla/Documents/sisgos/venv/lib/python2.7/site-packages/django/core/handlers/base.py", line 185, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/Users/adrianmansilla/Documents/sisgos/venv/lib/python2.7/site-packages/django/contrib/auth/decorators.py", line 23, in _wrapped_view
    return view_func(request, *args, **kwargs)
  File "/Users/adrianmansilla/Documents/sisgos/venv/lib/python2.7/site-packages/django/utils/decorators.py", line 185, in inner
    return func(*args, **kwargs)
  File "/Users/adrianmansilla/Documents/sisgos/sisgos/company/views.py", line 129, in new_user
    validate_password(password, new_user)
  File "/Users/adrianmansilla/Documents/sisgos/venv/lib/python2.7/site-packages/django/contrib/auth/password_validation.py", line 56, in validate_password
    raise ValidationError(errors)
ValidationError: [u'La contrase\xf1a es demasiado similar a la de nombre de usuario.']

--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/c6146f4a-e890-47c3-a6b4-e0d237d0073f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Password validation Error with Latin characters

Claude Paroz
Hi Adrian,

I don't see anything related to Django development in your post. Maybe this was more for the django-users mailing list?

Claude

Le jeudi 30 novembre 2017 02:39:31 UTC+1, Adrian Mansilla a écrit :

I am using the function 'validate_password (password, new_user)' and I have my settings configured in Spanish, the problem comes when the validate_password function raises an error with the word 'contraseña' and shows me this error:
ValidationError: [u'La contrase\xf1a es demasiado similar a la de nombre de usuario.']
I am using python 2.7 and Django 1.11.4

This is the traceback:

Traceback (most recent call last):
  File "/Users/adrianmansilla/Documents/sisgos/venv/lib/python2.7/site-packages/django/core/handlers/exception.py", line 41, in inner
    response = get_response(request)
  File "/Users/adrianmansilla/Documents/sisgos/venv/lib/python2.7/site-packages/django/core/handlers/base.py", line 187, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "/Users/adrianmansilla/Documents/sisgos/venv/lib/python2.7/site-packages/django/core/handlers/base.py", line 185, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/Users/adrianmansilla/Documents/sisgos/venv/lib/python2.7/site-packages/django/contrib/auth/decorators.py", line 23, in _wrapped_view
    return view_func(request, *args, **kwargs)
  File "/Users/adrianmansilla/Documents/sisgos/venv/lib/python2.7/site-packages/django/utils/decorators.py", line 185, in inner
    return func(*args, **kwargs)
  File "/Users/adrianmansilla/Documents/sisgos/sisgos/company/views.py", line 129, in new_user
    validate_password(password, new_user)
  File "/Users/adrianmansilla/Documents/sisgos/venv/lib/python2.7/site-packages/django/contrib/auth/password_validation.py", line 56, in validate_password
    raise ValidationError(errors)
ValidationError: [u'La contrase\xf1a es demasiado similar a la de nombre de usuario.']

--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/41974e26-5baf-41bd-90c6-bd5232f2a5c9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Password validation Error with Latin characters

Adrian Mansilla
Thanks for the reply.
I assumed that the error is in django because I do not send that message, Django sends it, the error is in:

django/contrib/auth/password_validation.py

And it's because my configuration is in Spanish.

El jueves, 30 de noviembre de 2017, 3:48:28 (UTC-4), Claude Paroz escribió:
Hi Adrian,

I don't see anything related to Django development in your post. Maybe this was more for the django-users mailing list?

Claude

Le jeudi 30 novembre 2017 02:39:31 UTC+1, Adrian Mansilla a écrit :

I am using the function 'validate_password (password, new_user)' and I have my settings configured in Spanish, the problem comes when the validate_password function raises an error with the word 'contraseña' and shows me this error:
ValidationError: [u'La contrase\xf1a es demasiado similar a la de nombre de usuario.']
I am using python 2.7 and Django 1.11.4

This is the traceback:

Traceback (most recent call last):
  File "/Users/adrianmansilla/Documents/sisgos/venv/lib/python2.7/site-packages/django/core/handlers/exception.py", line 41, in inner
    response = get_response(request)
  File "/Users/adrianmansilla/Documents/sisgos/venv/lib/python2.7/site-packages/django/core/handlers/base.py", line 187, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "/Users/adrianmansilla/Documents/sisgos/venv/lib/python2.7/site-packages/django/core/handlers/base.py", line 185, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/Users/adrianmansilla/Documents/sisgos/venv/lib/python2.7/site-packages/django/contrib/auth/decorators.py", line 23, in _wrapped_view
    return view_func(request, *args, **kwargs)
  File "/Users/adrianmansilla/Documents/sisgos/venv/lib/python2.7/site-packages/django/utils/decorators.py", line 185, in inner
    return func(*args, **kwargs)
  File "/Users/adrianmansilla/Documents/sisgos/sisgos/company/views.py", line 129, in new_user
    validate_password(password, new_user)
  File "/Users/adrianmansilla/Documents/sisgos/venv/lib/python2.7/site-packages/django/contrib/auth/password_validation.py", line 56, in validate_password
    raise ValidationError(errors)
ValidationError: [u'La contrase\xf1a es demasiado similar a la de nombre de usuario.']

--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/867d623d-7707-4f16-a779-293d8643b80f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Password validation Error with Latin characters

Ramiro Morales-2
Adrian,

I suspect:

1) Django is doing its work: It's checking the strenght and robustness of the password. It's detecting the password the user has chosen is too similar to their user name.

2) So, the fact the text shown has latin characters has nothng to do with the issue you are seeing.

3) The translation ('es') you are using isn't correct (https://github.com/django/django/blob/1a34dfcf797640d5d580d261694cb54e6f97c552/django/contrib/auth/locale/es/LC_MESSAGES/django.po#L258) and this might be what is misleading you.

   The original English text is

     The password is too similar to the %(verbose_name)s.
   
   and the translation should be:

     La contraseña es demasiado similar a {{ verbose_name }}

   verbose_name has the value "nombre de usuario" in this context.

   To confirm this you could temporarily set the languante to English (en-us) or to the es-ar (castellano as it's used in Argentina) and verify the original text/a more correct translation (https://github.com/django/django/blob/1a34dfcf797640d5d580d261694cb54e6f97c552/django/contrib/auth/locale/es_AR/LC_MESSAGES/django.po#L253)

As Claude said, Please open a thread in the django-users mailing lis i f you need to follow up this.


On Thu, Nov 30, 2017 at 9:09 AM, Adrian Mansilla <[hidden email]> wrote:
Thanks for the reply.
I assumed that the error is in django because I do not send that message, Django sends it, the error is in:

django/contrib/auth/password_validation.py

And it's because my configuration is in Spanish.

El jueves, 30 de noviembre de 2017, 3:48:28 (UTC-4), Claude Paroz escribió:
Hi Adrian,

I don't see anything related to Django development in your post. Maybe this was more for the django-users mailing list?

Claude

Le jeudi 30 novembre 2017 02:39:31 UTC+1, Adrian Mansilla a écrit :

I am using the function 'validate_password (password, new_user)' and I have my settings configured in Spanish, the problem comes when the validate_password function raises an error with the word 'contraseña' and shows me this error:
ValidationError: [u'La contrase\xf1a es demasiado similar a la de nombre de usuario.']
I am using python 2.7 and Django 1.11.4

This is the traceback:

Traceback (most recent call last):
  File "/Users/adrianmansilla/Documents/sisgos/venv/lib/python2.7/site-packages/django/core/handlers/exception.py", line 41, in inner
    response = get_response(request)
  File "/Users/adrianmansilla/Documents/sisgos/venv/lib/python2.7/site-packages/django/core/handlers/base.py", line 187, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "/Users/adrianmansilla/Documents/sisgos/venv/lib/python2.7/site-packages/django/core/handlers/base.py", line 185, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/Users/adrianmansilla/Documents/sisgos/venv/lib/python2.7/site-packages/django/contrib/auth/decorators.py", line 23, in _wrapped_view
    return view_func(request, *args, **kwargs)
  File "/Users/adrianmansilla/Documents/sisgos/venv/lib/python2.7/site-packages/django/utils/decorators.py", line 185, in inner
    return func(*args, **kwargs)
  File "/Users/adrianmansilla/Documents/sisgos/sisgos/company/views.py", line 129, in new_user
    validate_password(password, new_user)
  File "/Users/adrianmansilla/Documents/sisgos/venv/lib/python2.7/site-packages/django/contrib/auth/password_validation.py", line 56, in validate_password
    raise ValidationError(errors)
ValidationError: [u'La contrase\xf1a es demasiado similar a la de nombre de usuario.']

--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/867d623d-7707-4f16-a779-293d8643b80f%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Ramiro Morales
@ramiromorales

--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/CAO7PdF9Xejk7qJsqUX27ZMy5CgTEWO4d8m_ENVdVFRVWY1x87A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.