0003-ppolicy-improve-timeBeforeExpiration-date-formating.patch
src/authentic2/backends/ldap_backend.py | ||
---|---|---|
39 | 39 |
from django.core.exceptions import ImproperlyConfigured |
40 | 40 |
from django.db.models import Q |
41 | 41 |
from django.db.transaction import atomic |
42 |
from django.utils.dateformat import format as dateformat |
|
43 | 42 |
from django.utils.encoding import force_bytes, force_str |
43 |
from django.utils.formats import localize |
|
44 |
from django.utils.timezone import is_aware, localtime |
|
44 | 45 |
from django.utils.translation import gettext as _ |
45 | 46 |
from django.utils.translation import ngettext |
46 | 47 |
from ldap.controls import DecodeControlTuples, SimplePagedResultsControl, ppolicy |
... | ... | |
251 | 252 |
expiration_date = datetime.datetime.fromtimestamp(time.time() + ctrl.timeBeforeExpiration) |
252 | 253 |
messages.append( |
253 | 254 |
_('The password will expire at {expiration_date}.').format( |
254 |
expiration_date=dateformat(expiration_date, 'l j F Y, P') |
|
255 |
expiration_date=localize( |
|
256 |
localtime(expiration_date) if is_aware(expiration_date) else expiration_date |
|
257 |
) |
|
255 | 258 |
) |
256 | 259 |
) |
257 | 260 |
if ctrl.graceAuthNsRemaining: |
258 |
- |