Use expire delay instead of UTC datetime in reset password email
issue10906 review381291002
This commit is contained in:
1 parent
357dfd9286
commit
fd9cde4d9a
3 files changed
+10
-2
No files matched your search
@@ -1,3 +1,4 @@
|
||||
* Use expire delay instead of UTC datetime in reset password email
|
||||
* Use RENAME and DROP COLUMN with SQLite backend
|
||||
* Support window functions with SQLite backend
|
||||
* Use JSONB to store Dict field on PostgreSQL backend
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
</div>
|
||||
<hr style="margin-top: 20px; border-style: solid none none; border-color: #EEE"></hr>
|
||||
<div style="font-size: 80%; color: #777">
|
||||
<p i18n:msg="datetime">
|
||||
The password will expire at <time datetime="${record.password_reset_expire.isoformat()}">${expire} UTC</time>.
|
||||
<p i18n:msg="datetime,expire_delay">
|
||||
The password will expire in <time datetime="${record.password_reset_expire.isoformat()}">${format_timedelta(expire_delay)}</time>.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1179,6 +1179,13 @@ class EmailResetPassword(Report):
|
||||
context['expire'] = lang.strftime(
|
||||
records[0].password_reset_expire,
|
||||
format=lang.date + ' %H:%M:%S')
|
||||
expire_delay = (
|
||||
records[0].password_reset_expire - datetime.datetime.now())
|
||||
# Use a precision of minutes
|
||||
expire_delay = datetime.timedelta(
|
||||
days=expire_delay.days,
|
||||
minutes=round(expire_delay.seconds / 60))
|
||||
context['expire_delay'] = expire_delay
|
||||
return context
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user