Add expire delay in reset password email
and use Genshi i18n issue11424 review382501002
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns:py="http://genshi.edgewall.org/">
|
||||
<html xmlns:py="http://genshi.edgewall.org/" xmlns:i18n="http://genshi.edgewall.org/i18n">
|
||||
<head>
|
||||
<title>Reset Password</title>
|
||||
</head>
|
||||
@@ -8,20 +8,17 @@
|
||||
<div style="display: block; text-align: center">
|
||||
<div>
|
||||
<h1>Reset Password</h1>
|
||||
<p>We received a request to reset the password for your account,
|
||||
${user.email}</p>
|
||||
<p i18n:msg="email">We received a request to reset the password for your account: ${user.email}</p>
|
||||
<a href="${user.get_email_reset_password_url()}"
|
||||
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;">
|
||||
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
|
||||
</a>
|
||||
</div>
|
||||
<hr style="margin-top: 20px;
|
||||
border-style: solid none none; border-color: #EEE"></hr>
|
||||
<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,expire_delay">
|
||||
The link will expire in <time datetime="${record.reset_password_token_expire.isoformat()}">${format_timedelta(expire_delay)}</time>.
|
||||
</p>
|
||||
<p>Button is not working? Paste this into your browser:</p>
|
||||
<p>${user.get_email_reset_password_url()}</p>
|
||||
<p>If you didn't make this request, you can ignore this email.</p>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns:py="http://genshi.edgewall.org/">
|
||||
<html xmlns:py="http://genshi.edgewall.org/" xmlns:i18n="http://genshi.edgewall.org/i18n">
|
||||
<head>
|
||||
<title>Email Validation</title>
|
||||
</head>
|
||||
@@ -8,18 +8,13 @@
|
||||
<div style="display: block; text-align: center">
|
||||
<div>
|
||||
<h1>Just one more step..</h1>
|
||||
<p>${user.email}</p>
|
||||
<p i18n:msg="email">${user.email}</p>
|
||||
<a href="${user.get_email_validation_url()}"
|
||||
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;">
|
||||
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
|
||||
</a>
|
||||
</div>
|
||||
<hr style="margin-top: 20px;
|
||||
border-style: solid none none; border-color: #EEE"></hr>
|
||||
<hr style="margin-top: 20px; border-style: solid none none; border-color: #EEE"></hr>
|
||||
<div style="font-size: 80%; color: #777">
|
||||
<p>Button is not working? Paste this into your browser:</p>
|
||||
<p>${user.get_email_validation_url()}</p>
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user