From 0e26adc60d97b6c7bf69b6c2b75224f575320b0d Mon Sep 17 00:00:00 2001 From: Eliot Partridge Date: Thu, 29 Jun 2017 21:18:22 -0500 Subject: [PATCH] Email touchups, yay --- app/Controllers/Auth/PasswordController.php | 5 +- resources/views/email/password-reset.twig | 42 +- resources/views/email/templates/default.twig | 575 +++++++++--------- .../email/templates/partials/footer.twig | 8 +- 4 files changed, 320 insertions(+), 310 deletions(-) diff --git a/app/Controllers/Auth/PasswordController.php b/app/Controllers/Auth/PasswordController.php index e6bfb8d..87a74ff 100644 --- a/app/Controllers/Auth/PasswordController.php +++ b/app/Controllers/Auth/PasswordController.php @@ -114,6 +114,7 @@ private function getRecoveryToken($identifier, $token) { if (strtotime($dbToken->expires) > time()) { return $dbToken; } else { + $dbToken->delete(); return null; } } @@ -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', 'Whoops! 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); } @@ -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', 'Whoops! 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); } diff --git a/resources/views/email/password-reset.twig b/resources/views/email/password-reset.twig index 3bd5ed9..52653a9 100644 --- a/resources/views/email/password-reset.twig +++ b/resources/views/email/password-reset.twig @@ -1,25 +1,27 @@ {% extends 'email/templates/default.twig' %} -{% block preheader %}Instructions to reset your account password may be found here.{% endblock %} - {% block content %} -

Hi there,

-

Looks like you requested a password reset.

- - - - - - + +
- - - - - - -
Reset my password
-
+ + + + + + + + + + + +
+ Hi there, +
+ 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, so is your {{ settings.site.title | default('sleeti') }} account! +
+ +
+ — {{ settings.site.title | default('sleeti') }} +
-

If you requested this reset, click the link above to reset your password.

-

If you did not request this reset, disregard this email. However, pay attention to your email account security; if this email is compromised, so is your {{ settings.site.title | default('sleeti') }} account!

{% endblock %} diff --git a/resources/views/email/templates/default.twig b/resources/views/email/templates/default.twig index ddf4069..477347d 100644 --- a/resources/views/email/templates/default.twig +++ b/resources/views/email/templates/default.twig @@ -1,299 +1,310 @@ - - + + {{ subject }} - - - + +
- - + - +
  +
- {% block preheader %}{% endblock %} - +
-
- - - - -
- {% block content %}{% endblock %} -
+
+ {% block content %}{% endblock %}
- - {% include 'email/templates/partials/footer.twig' %} -
+ {% include 'email/templates/partials/footer.twig' %}
 
diff --git a/resources/views/email/templates/partials/footer.twig b/resources/views/email/templates/partials/footer.twig index 553c2f4..fad9cdd 100644 --- a/resources/views/email/templates/partials/footer.twig +++ b/resources/views/email/templates/partials/footer.twig @@ -1,11 +1,7 @@ - -