Projet

Général

Profil

0001-ldap-backend-only-format-ppolicy-errors-message-if-o.patch

Benjamin Renard, 20 juin 2022 13:30

Télécharger (2,38 ko)

Voir les différences:

Subject: [PATCH] ldap backend: only format ppolicy errors message if occured

License: MIT
 src/authentic2/backends/ldap_backend.py | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
src/authentic2/backends/ldap_backend.py
213 213
    if ctrl.error:
214 214
        error = ppolicy.PasswordPolicyError.namedValues[ctrl.error]
215 215
        error2message = {
216
            'passwordExpired': _('The password expired after {pwdmaxage}').format(**attributes),
216
            'passwordExpired': _('The password expired after {pwdmaxage}'),
217 217
            'accountLocked': _(
218 218
                'The account is locked since {pwdaccountlockedtime[0]} after {pwdmaxfailure} failures.'
219
            ).format(**attributes),
219
            ),
220 220
            'changeAfterReset': _('The password was reset and must be changed.'),
221 221
            'passwordModNotAllowed': _('It is not possible to modify the password.'),
222 222
            'mustSupplyOldPassword': _('The old password must be supplied.'),
223 223
            'insufficientPasswordQuality': _('The password does not meet the quality requirements.'),
224
            'passwordTooShort': _('The password is too short {pwdminlength}.').format(**attributes),
225
            'passwordTooYoung': _('It is too soon to change the password {pwdminage}.').format(**attributes),
224
            'passwordTooShort': _('The password is too short {pwdminlength}.'),
225
            'passwordTooYoung': _('It is too soon to change the password {pwdminage}.'),
226 226
            'passwordInHistory': _(
227 227
                'This password is among the last {pwdhistory} password that were used and cannot be used'
228 228
                ' again.'
229
            ).format(**attributes),
229
            ),
230 230
        }
231
        messages.append(error2message.get(error, _('Unexpected error {error}').format(error=error)))
231
        messages.append(
232
            error2message.get(error, _('Unexpected error {error}').format(error=error)).format(**attributes)
233
        )
232 234
        return messages
233 235

  
234 236
    if ctrl.timeBeforeExpiration:
235
-