Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
FUSS
octonet
Commits
6c5d0488
Commit
6c5d0488
authored
Mar 19, 2020
by
Mark Caglienzi
Browse files
Fix next_password_change* calculations and messages. refs #9972
parent
05272ce5
Changes
1
Hide whitespace changes
Inline
Side-by-side
users/views.py
View file @
6c5d0488
...
...
@@ -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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment