Commit 6c5d0488 authored by Mark Caglienzi's avatar Mark Caglienzi
Browse files

Fix next_password_change* calculations and messages. refs #9972

parent 05272ce5
......@@ -147,7 +147,12 @@ class UserMixin(OctonetMixin):
self.user['last_password_change_days'] = _("0 day(s) ago")
next_password_change = last_password_change + datetime.timedelta(days=shadowMax)
self.user['next_password_change'] = next_password_change.strftime("%Y-%m-%d")
self.user['next_password_change_days'] = _("in {} day(s)").format((next_password_change - today).days)
if next_password_change < today:
self.user['next_password_change_days'] = _("{} day(s) ago").format((today - next_password_change).days)
elif next_password_change > today:
self.user['next_password_change_days'] = _("in {} day(s)").format((next_password_change - today).days)
else:
self.user['next_password_change_days'] = _("Today!")
def get_context_data(self, **kw):
ctx = super().get_context_data(**kw)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment