Skip to content

Commit 267fcff

Browse files
committed
Update password reset to add email
1 parent 96354a8 commit 267fcff

14 files changed

Lines changed: 255 additions & 139 deletions

File tree

config/dev.exs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ config :code_corps, CodeCorps.Mailer,
6060
adapter: Bamboo.LocalAdapter
6161

6262
config :code_corps,
63+
postmark_forgot_password_template: "123",
6364
postmark_project_acceptance_template: "123",
6465
postmark_receipt_template: "123"
6566

config/prod.exs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ config :code_corps, CodeCorps.Mailer,
6161
api_key: System.get_env("POSTMARK_API_KEY")
6262

6363
config :code_corps,
64+
postmark_forgot_password_template: "1989483",
6465
postmark_project_acceptance_template: "1447041",
6566
postmark_receipt_template: "1255222"
6667

config/remote-development.exs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ config :code_corps, CodeCorps.Mailer,
4343
adapter: Bamboo.LocalAdapter
4444

4545
config :code_corps,
46+
postmark_forgot_password_template: "123",
4647
postmark_project_acceptance_template: "123",
4748
postmark_receipt_template: "123"
4849

config/staging.exs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ config :code_corps, CodeCorps.Mailer,
5959
api_key: System.get_env("POSTMARK_API_KEY")
6060

6161
config :code_corps,
62+
postmark_forgot_password_template: "1989481",
6263
postmark_project_acceptance_template: "1447022",
6364
postmark_receipt_template: "1252361"
6465

config/test.exs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ config :code_corps, CodeCorps.Mailer,
4848
adapter: Bamboo.TestAdapter
4949

5050
config :code_corps,
51+
postmark_forgot_password_template: "123",
5152
postmark_project_acceptance_template: "123",
5253
postmark_receipt_template: "123"
5354

emails/forgot_password.html

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2+
<html xmlns="http://www.w3.org/1999/xhtml">
3+
<head>
4+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
5+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6+
<title>Here's the link to reset your password.</title>
7+
<!--
8+
Make sure you copy the styles from styles.css into the email template in Postmark before saving there.
9+
10+
<style type="text/css" rel="stylesheet" media="all">
11+
</style>
12+
-->
13+
<link rel="stylesheet" type="text/css" href="styles.css" media="screen" />
14+
</head>
15+
<body>
16+
<span class="preheader">Here's the link to reset your password.</span>
17+
<table class="email-wrapper" width="100%" cellpadding="0" cellspacing="0">
18+
<tr>
19+
<td align="center">
20+
<table class="email-content" width="100%" cellpadding="0" cellspacing="0">
21+
<tr>
22+
<td class="email-masthead" width="100%" cellpadding="0" cellspacing="0">
23+
<table class="email-masthead_inner" align="center" width="570" cellpadding="0" cellspacing="0">
24+
<tr>
25+
<td>
26+
<a href="https://www.codecorps.org">
27+
<img src="https://d3pgew4wbk2vb1.cloudfront.net/emails/images/[email protected]" class="email-masthead_logo" />
28+
</a>
29+
</td>
30+
</tr>
31+
</table>
32+
</td>
33+
</tr>
34+
<!-- Email Body -->
35+
<tr>
36+
<td class="email-body" width="100%" cellpadding="0" cellspacing="0">
37+
<table class="email-body_inner" align="center" width="570" cellpadding="0" cellspacing="0">
38+
<!-- Body content -->
39+
<tr>
40+
<td class="content-cell">
41+
<table width="100%" cellpadding="0" cellspacing="0">
42+
<tr>
43+
<td>
44+
<p>Hi there,</p>
45+
<p>To reset your password, please <a href="{{link}}">click here</a> or paste this link into your browser:</p>
46+
<p><a href="{{link}}">{{link}}</a></p>
47+
<p>Your link is only valid for the next hour.</p>
48+
<p>If you have any issues, don't hesitate to <a href="https://help.codecorps.org">contact us</a>.</p>
49+
</td>
50+
</tr>
51+
</table>
52+
<table class="body-signature">
53+
<tr>
54+
<td>
55+
<p>
56+
Thanks!
57+
<br><strong>The Code Corps Team</strong>
58+
</p>
59+
<p class="center small">
60+
Questions? Feedback?
61+
<br>Visit our <strong><a href="https://help.codecorps.org">Help Center</a></strong> or just reply to this email.</p>
62+
</td>
63+
</tr>
64+
</table>
65+
</td>
66+
</tr>
67+
</table>
68+
</td>
69+
</tr>
70+
<tr>
71+
<td>
72+
<table class="email-footer" align="center" width="570" cellpadding="0" cellspacing="0">
73+
<tr>
74+
<td class="content-cell" align="center">
75+
<p class="sub align-center">
76+
Code Corps PBC
77+
<br>4166 Wilson Ave #1
78+
<br>San Diego, CA 92104
79+
</p>
80+
</td>
81+
</tr>
82+
</table>
83+
</td>
84+
</tr>
85+
</table>
86+
</td>
87+
</tr>
88+
</table>
89+
</body>
90+
</html>

lib/code_corps/cloudex/cloudex_test.ex

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,11 @@ defmodule CloudexTest do
66
"""
77

88
defmodule Url do
9-
def for(public_id, options) do
10-
{public_id, options}
9+
def for(_public_id, %{height: height, width: width}) do
10+
"https://placehold.it/#{width}x#{height}"
11+
end
12+
def for(_public_id, _options) do
13+
"https://placehold.it/500x500"
1114
end
1215
end
1316
end

lib/code_corps/services/forgot_password.ex

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ defmodule CodeCorps.Services.ForgotPasswordService do
33
alias CodeCorps.{AuthToken, Emails, Mailer, Repo, User}
44

55
@doc"""
6-
forgot_password should take an email and generate an AuthToken model and send an email
6+
Generates an AuthToken model and sends to the provided email.
77
"""
88
def forgot_password(email) do
99
with %User{} = user <- Repo.get_by(User, email: email),
@@ -14,5 +14,4 @@ defmodule CodeCorps.Services.ForgotPasswordService do
1414
nil -> nil
1515
end
1616
end
17-
1817
end

0 commit comments

Comments
 (0)