diff --git a/CHANGELOG b/CHANGELOG index 1814ecf754..9af17db64e 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,5 @@ +* Add expire delay in reset password email + Version 6.4.0 - 2022-05-02 * Bug fixes (see mercurial logs for details) * Add support for Python 3.10 diff --git a/email_reset_password.html b/email_reset_password.html index aa78c7bdb7..6b9a2979d0 100644 --- a/email_reset_password.html +++ b/email_reset_password.html @@ -1,5 +1,5 @@ - + Reset Password @@ -8,20 +8,17 @@

Reset Password

-

We received a request to reset the password for your account, - ${user.email}

+

We received a request to reset the password for your account: ${user.email}

+ style="display: block; text-decoration: none; width: max-content; margin: 0 auto; padding: 0.5em 1em; font-size:2em; border: 1px solid #2E6DA4; border-radius: 4px; color: #FFF; background-color: #337AB7;"> Reset Password
-
+
+

+ The link will expire in . +

Button is not working? Paste this into your browser:

${user.get_email_reset_password_url()}

If you didn't make this request, you can ignore this email.

diff --git a/email_validation.html b/email_validation.html index 840e7e2e95..74ab78a52f 100644 --- a/email_validation.html +++ b/email_validation.html @@ -1,5 +1,5 @@ - + Email Validation @@ -8,18 +8,13 @@

Just one more step..

-

${user.email}

+

${user.email}

+ style="display: block; text-decoration: none; width: max-content; margin: 0 auto; padding: 0.5em 1em; font-size:2em; border: 1px solid #2E6DA4; border-radius: 4px; color: #FFF; background-color: #337AB7;"> Validate
-
+

Button is not working? Paste this into your browser:

${user.get_email_validation_url()}

diff --git a/user.py b/user.py index 3e351a5c4b..51c4c1da48 100644 --- a/user.py +++ b/user.py @@ -518,4 +518,11 @@ class EmailResetPassword(Report): def get_context(cls, records, header, data): context = super().get_context(records, header, data) context['extract_params'] = _extract_params + expire_delay = ( + records[0].reset_password_token_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