Projet

Général

Profil

0002-ppolicy-clean-computing-passwordTooShort-error-messa.patch

Benjamin Renard, 27 septembre 2023 17:03

Télécharger (2,04 ko)

Voir les différences:

Subject: [PATCH 2/3] ppolicy: clean computing passwordTooShort error message

License: MIT
 src/authentic2/backends/ldap_backend.py | 6 ++++--
 tests/test_ldap.py                      | 3 ++-
 2 files changed, 6 insertions(+), 3 deletions(-)
src/authentic2/backends/ldap_backend.py
234 234
            'passwordModNotAllowed': _('It is not possible to modify the password.'),
235 235
            'mustSupplyOldPassword': _('The old password must be supplied.'),
236 236
            'insufficientPasswordQuality': _('The password does not meet the quality requirements.'),
237
            'passwordTooShort': _('The password is too short{minlength}.').format(
238
                minlength=(" (minimun length: %s)" % attributes['pwdminlength'][0])
237
            'passwordTooShort': _('The password is too short.{minlength}').format(
238
                minlength=_(" The minimun length is {minlength} characters.").format(
239
                    minlength=attributes['pwdminlength'][0]
240
                )
239 241
                if attributes['pwdminlength']
240 242
                else ""
241 243
            ),
tests/test_ldap.py
1448 1448
    response.form['new_password2'] = NEW_PASS
1449 1449
    response = response.form.submit().maybe_follow()
1450 1450

  
1451
    assert f'The password is too short (minimun length: {pwdMinLength})' in response.text
1451
    assert f'The password is too short.' in response.text
1452
    assert f'The minimun length is {pwdMinLength} characters.' in response.text
1452 1453

  
1453 1454

  
1454 1455
def test_user_change_password_too_soon(slapd_ppolicy, settings, app, db):
1455
-