#35782: Password validator custom error messages
-------------------------------------+-------------------------------------
     Reporter:  bcail                |                    Owner:  bcail
         Type:                       |                   Status:  new
  Cleanup/optimization               |
    Component:  contrib.auth         |                  Version:  dev
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:  Ready for
                                     |  checkin
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Hamidreza Samsami):

 * resolution:  fixed =>
 * status:  closed => new

Comment:

 In your recent change to
 
django.contrib.auth.password_validation.MinimumLengthValidator.get_error_message,
 you removed the 'min_length' named placeholder from the translation
 string:

  "This password is too short. It must contain at least %d characters."

 It should be changed to:

  "This password is too short. It must contain at least %(min_length)d
 characters."

 As a result of this change, all languages except those listed below no
 longer work correctly. Additionally, the following translation files
 should be updated:

  django/contrib/auth/locale/af/LC_MESSAGES/django.po
  django/contrib/auth/locale/da/LC_MESSAGES/django.po
  django/contrib/auth/locale/dsb/LC_MESSAGES/django.po
  django/contrib/auth/locale/en/LC_MESSAGES/django.po
  django/contrib/auth/locale/es_AR/LC_MESSAGES/django.po
  django/contrib/auth/locale/et/LC_MESSAGES/django.po
  django/contrib/auth/locale/fi/LC_MESSAGES/django.po
  django/contrib/auth/locale/fr/LC_MESSAGES/django.po
  django/contrib/auth/locale/he/LC_MESSAGES/django.po
  django/contrib/auth/locale/hsb/LC_MESSAGES/django.po
  django/contrib/auth/locale/hu/LC_MESSAGES/django.po
  django/contrib/auth/locale/id/LC_MESSAGES/django.po
  django/contrib/auth/locale/ko/LC_MESSAGES/django.po
  django/contrib/auth/locale/lv/LC_MESSAGES/django.po
  django/contrib/auth/locale/pl/LC_MESSAGES/django.po
  django/contrib/auth/locale/pt/LC_MESSAGES/django.po
  django/contrib/auth/locale/sq/LC_MESSAGES/django.po
  django/contrib/auth/locale/sr/LC_MESSAGES/django.po
  django/contrib/auth/locale/sr_Latn/LC_MESSAGES/django.po
  django/contrib/auth/locale/tr/LC_MESSAGES/django.po
  django/contrib/auth/locale/uk/LC_MESSAGES/django.po
  django/contrib/auth/locale/zh_Hant/LC_MESSAGES/django.po
 I believe the get_error_message function should be defined as follows:
 {{{
 def get_error_message(self):
     return (
         ngettext(
             "This password is too short. It must contain at least
 %(min_length)d character.",
             "This password is too short. It must contain at least
 %(min_length)d characters.",
             self.min_length,
         ) % {"min_length": self.min_length}
     )
 }}}

 If possible, I can make this change and update the corresponding test as
 well.
-- 
Ticket URL: <https://code.djangoproject.com/ticket/35782#comment:14>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/django-updates/01070196f323290e-e7f7ac41-1c17-4ea3-829e-4292fa47b333-000000%40eu-central-1.amazonses.com.

Reply via email to