Skip to content

Commit

Permalink
Email touchups, yay
Browse files Browse the repository at this point in the history
  • Loading branch information
BytewaveMLP committed Jun 30, 2017
1 parent 2a60b94 commit 0e26adc
Show file tree
Hide file tree
Showing 4 changed files with 320 additions and 310 deletions.
5 changes: 3 additions & 2 deletions app/Controllers/Auth/PasswordController.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ private function getRecoveryToken($identifier, $token) {
if (strtotime($dbToken->expires) > time()) {
return $dbToken;
} else {
$dbToken->delete();
return null;
}
}
Expand All @@ -128,7 +129,7 @@ public function getResetPassword($request, $response) {
$token = $request->getParam('token');

if (!$this->getRecoveryToken($identifier, $token)) {
$this->container->flash->addMessage('danger', 'Invalid or missing password recovery token!');
$this->container->flash->addMessage('danger', '<b>Whoops!</b> Looks like your link may have expired or been deleted. Please try resetting your password again, or contact the administrators if the problem persists.');
return $response->withRedirect($this->container->router->pathFor('home'))->withStatus(403);
}

Expand All @@ -145,7 +146,7 @@ public function postResetPassword($request, $response) {
$dbToken = $this->getRecoveryToken($identifier, $token);

if (!$dbToken) {
$this->container->flash->addMessage('danger', 'Invalid or missing password recovery token!');
$this->container->flash->addMessage('danger', '<b>Whoops!</b> Looks like your link may have expired or been deleted. Please try resetting your password again, or contact the administrators if the problem persists.');
return $response->withRedirect($this->container->router->pathFor('home'))->withStatus(403);
}

Expand Down
42 changes: 22 additions & 20 deletions resources/views/email/password-reset.twig
Original file line number Diff line number Diff line change
@@ -1,25 +1,27 @@
{% extends 'email/templates/default.twig' %}

{% block preheader %}Instructions to reset your account password may be found here.{% endblock %}

{% block content %}
<p>Hi there,</p>
<p>Looks like you requested a password reset.</p>
<table border="0" cellpadding="0" cellspacing="0" class="btn btn-primary">
<tbody>
<tr>
<td align="left">
<table border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td> <a href="{{ base_url }}{{ path_for('auth.password.reset') }}?identifier={{ identifier }}&amp;token={{ token }}" target="_blank">Reset my password</a> </td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
<meta itemprop="name" content="Confirm Email"/>
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td class="content-block">
<b>Hi there,</b>
</td>
</tr>
<tr>
<td class="content-block">
We received a request to reset your {{ settings.site.title | default('sleeti') }} account password. If you requested this change, click the link below to reset your passwrd. If you did not request this reset, disregard this email. However, pay attention to your email account security; if this email is compromised, <b>so is your {{ settings.site.title | default('sleeti') }} account</b>!
</td>
</tr>
<tr>
<td class="content-block" itemprop="handler" itemscope itemtype="http://schema.org/HttpActionHandler">
<a href="{{ base_url }}{{ path_for('auth.password.reset') }}?identifier={{ identifier }}&amp;token={{ token }}" target="_blank" class="btn-primary" itemprop="url">Reset my password</a>
</td>
</tr>
<tr>
<td class="content-block">
&mdash; {{ settings.site.title | default('sleeti') }}
</td>
</tr>
</table>
<p>If you requested this reset, click the link above to reset your password.</p>
<p>If you did not request this reset, disregard this email. However, pay attention to your email account security; if this email is compromised, <b>so is your {{ settings.site.title | default('sleeti') }} account</b>!</p>
{% endblock %}
Loading

0 comments on commit 0e26adc

Please sign in to comment.