ldap: fix misleading variable /timeBeforeExpiration/expiration_date/ (#51274)

The timeBeforeExpiration obtained from ppolicy is the number of
seconds left until the password expires. Before it is inserted in the
error message it is translated into a date because it is easier to
internationalize. The variable name should be changed to reflect this
modification otherwise it will be misleading to translators.

Fixes: #51274

License: MIT
This commit is contained in:
Loïc Dachary 2021-02-19 08:27:40 +01:00 committed by Valentin Deniaud
parent 2c6c03a9c8
commit 409305831c
2 changed files with 5 additions and 5 deletions

View File

@ -257,9 +257,9 @@ def password_policy_control_messages(ctrl):
return messages
if ctrl.timeBeforeExpiration:
timeBeforeExpiration = time.asctime(time.localtime(time.time() + ctrl.timeBeforeExpiration))
messages.append(_('The password will expire at {timeBeforeExpiration}.').format(
timeBeforeExpiration=timeBeforeExpiration))
expiration_date = time.asctime(time.localtime(time.time() + ctrl.timeBeforeExpiration))
messages.append(_('The password will expire at {expiration_date}.').format(
expiration_date=expiration_date))
if ctrl.graceAuthNsRemaining:
messages.append(ngettext(
'This password expired: this is the last time it can be used.',

View File

@ -875,8 +875,8 @@ msgstr "Erreur technique {error}"
#: src/authentic2/backends/ldap_backend.py:261
#, python-brace-format
msgid "The password will expire at {timeBeforeExpiration}."
msgstr "Votre mot de passe ne sera plus valable dans {timeBeforeExpiration}."
msgid "The password will expire at {expiration_date}."
msgstr "Votre mot de passe ne sera plus valable le {expiration_date}."
#: src/authentic2/backends/ldap_backend.py:265
#, python-brace-format