Skip to content

Commit

Permalink
Add reset password email in new theme
Browse files Browse the repository at this point in the history
  • Loading branch information
mlandauer committed Sep 18, 2023
1 parent 4e22987 commit 9502b9c
Show file tree
Hide file tree
Showing 5 changed files with 173 additions and 19 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html charset=UTF-8">
</head>
<body>
<% if resource.name.present? %>
<p>Hello <%= resource.name %>!</p>
<% else %>
<p>Hello!</p>
<% end %>

<p>Please click the link below and follow the instructions. We'll have you up and running with a new password in no time.</p>

<p><%= link_to "Reset password", edit_password_url(resource, reset_password_token: token) %></p>

<p>Didn't request this email? Then you can safely ignore it.</p>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
<!DOCTYPE html>
<html lang="en" xmlns:v="urn:schemas-microsoft-com:vml">
<head>
<meta charset="utf-8">
<meta name="x-apple-disable-message-reformatting">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="format-detection" content="telephone=no, date=no, address=no, email=no, url=no">
<meta name="color-scheme" content="light dark">
<meta name="supported-color-schemes" content="light dark">
<!--[if mso]>
<noscript>
<xml>
<o:OfficeDocumentSettings xmlns:o="urn:schemas-microsoft-com:office:office">
<o:PixelsPerInch>96</o:PixelsPerInch>
</o:OfficeDocumentSettings>
</xml>
</noscript>
<style>
td,th,div,p,a,h1,h2,h3,h4,h5,h6 {font-family: "Segoe UI", sans-serif; mso-line-height-rule: exactly;}
</style>
<![endif]-->
<title>Reset password instructions</title>
<style>
.hover-underline:hover {
text-decoration-line: underline !important
}
@media (max-width: 600px) {
.sm-px-4 {
padding-left: 16px !important;
padding-right: 16px !important
}
}
@media (max-width: 425px) {
.xs-px-6 {
padding-left: 24px !important;
padding-right: 24px !important
}
.xs-py-3 {
padding-top: 12px !important;
padding-bottom: 12px !important
}
.xs-text-2xl {
font-size: 24px !important
}
.xs-text-8px {
font-size: 8px !important
}
}
@media (prefers-color-scheme: dark) {
.dark-mode-bg-_333 {
background-color: #333 !important
}
.dark-mode-text-white {
color: #ffffff !important
}
}
</style>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Fira+Sans:wght@100;200;300;400;500;600;700;800;900&family=Inter:wght@100;200;300;400;500;600;700;800;900&family=Merriweather:wght@300;400;500;700;900&display=fallback" rel="stylesheet">
</head>
<body class="dark-mode-bg-_333" style="margin: 0; width: 100%; background-color: #ffffff; padding: 0; -webkit-font-smoothing: antialiased; word-break: break-word">
<div style="display: none">
Please click the button below and follow the instructions. We'll have you up and running with a new password in no time.
&#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847; &#8199;&#65279;&#847;
</div>
<div role="article" aria-roledescription="email" aria-label="Reset password instructions" lang="en">
<div class="sm-px-4 dark-mode-text-white" style="font-family: Fira Sans, ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif; font-size: 18px; color: #414860">
<table align="center" cellpadding="0" cellspacing="0" role="none">
<tr>
<td style="width: 552px; max-width: 100%">
<table width="100%" style="font-family: Inter, Fira Sans, ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif" cellpadding="0" cellspacing="0" role="none">
<tr>
<td style="height: 24px; background-color: #E98E07"></td>
</tr>
<tr>
<td class="xs-px-6 xs-py-3" style="background-color: #F4BE53; padding: 24px 48px">
<table cellpadding="0" cellspacing="0" role="none">
<tr>
<td style="background-color: #CA3F94; padding: 4px 16px">
<h1 class="xs-text-2xl" style="margin: 0; font-size: 36px; font-weight: 800; color: #ffffff">Planning Alerts</h1>
</td>
</tr>
</table>
<table cellpadding="0" cellspacing="0" role="none">
<tr>
<td class="xs-text-8px" style="background-color: #826D9C; padding: 8px 16px; font-size: 12px; font-weight: 600; color: #ffffff">Email alerts of planning applications near you</td>
</tr>
</table>
</td>
</tr>
</table>
<div role="separator" style="line-height: 72px">&zwj;</div>
<p>Hello,</p>
<p>Please click the button below and follow the instructions.
We'll have you up and running with a new password in no time.
</p>
<p>Thanks,<br>Planning Alerts team</p>
<div role="separator" style="line-height: 48px">&zwj;</div>
<div>
<a href="<%= edit_password_url(resource, reset_password_token: token) %>" style="display: inline-block; background-color: #03827A; padding: 16px 32px; font-size: 18px; font-weight: 600; line-height: 1; color: #ffffff; text-decoration: none">
<!--[if mso]>
<i style="mso-font-width: -100%; letter-spacing: 32px; mso-text-raise: 30px" hidden>&nbsp;</i>
<![endif]-->
<span style="mso-text-raise: 16px">
Reset password
</span>
<!--[if mso]>
<i style="mso-font-width: -100%; letter-spacing: 32px;" hidden>&nbsp;</i>
<![endif]-->
</a>
</div>
<div role="separator" style="line-height: 48px">&zwj;</div>
<table style="width: 100%;" cellpadding="0" cellspacing="0" role="none">
<tr>
<td align="right">
<img src="<%= image_path "tailwind/reset-password-illustration.png" %>" alt="Illustration of a woman with glasses using her laptop" style="max-width: 100%; vertical-align: middle; line-height: 1; border: 0">
</td>
</tr>
</table>
<div role="separator" style="line-height: 72px">&zwj;</div>
<p>Didn't request this email? Then you can safely ignore it.</p>
<div role="separator" style="background-color: #e2e8f0; height: 1px; line-height: 1px; margin: 32px 0">&zwj;</div>
<p>
<a href="https://www.planningalerts.org.au" class="dark-mode-text-white hover-underline" style="color: #414860; text-decoration-line: none"><strong>Planning Alerts</strong></a>
is a free service where anyone can find out what is being built and knocked down in their area.
</p>
<p>
The service
is run by the independent charity
<a href="https://www.oaf.org.au/" class="dark-mode-text-white hover-underline" style="color: #414860; text-decoration-line: none">OpenAustralia Foundation</a>.
</p>
<p>
<a href="https://www.planningalerts.org.au/help/contact" style="color: #D37708">Contact us</a>
</p>
</td>
</tr>
</table>
</div>
</div>
</body>
</html>
24 changes: 5 additions & 19 deletions app/views/devise/mailer/reset_password_instructions.html.erb
Original file line number Diff line number Diff line change
@@ -1,19 +1,5 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html charset=UTF-8">
</head>
<body>
<% if @resource.name.present? %>
<p>Hello <%= @resource.name %>!</p>
<% else %>
<p>Hello!</p>
<% end %>

<p>Please click the link below and follow the instructions. We'll have you up and running with a new password in no time.</p>

<p><%= link_to "Reset password", edit_password_url(@resource, reset_password_token: @token) %></p>

<p>Didn't request this email? Then you can safely ignore it.</p>
</body>
</html>
<% if @resource.tailwind_theme %>
<%= render "reset_password_instructions_new_theme", resource: @resource, token: @token %>
<% else %>
<%= render "reset_password_instructions_current_theme", resource: @resource, token: @token %>
<% end %>
7 changes: 7 additions & 0 deletions spec/mailers/previews/login_and_account_preview.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ def reset_password_instructions
Devise::Mailer.reset_password_instructions(user, "faketoken")
end

# It shows a different email address in the "to" and the body of the email.
# TODO: Figure out what's going on and fix it
def reset_password_instructions_new_theme
user = FactoryBot.build_stubbed(:user, name: "Matthew", tailwind_theme: true)
Devise::Mailer.reset_password_instructions(user, "faketoken")
end

def activate_account_instructions
user = FactoryBot.build_stubbed(:user)
Users::ActivationMailer.notify(user, "faketoken")
Expand Down

0 comments on commit 9502b9c

Please sign in to comment.