Browse Source

Make sure the reset code is trimmed and fix the link in email buttons so it's white.

master
Zed A. Shaw 1 month ago
parent
commit
8ae8a1f51f
  1. 3
      api/password_reset.js
  2. 5
      emails/invoice.html
  3. 123
      emails/receipt.html
  4. 4
      emails/register_email.html
  5. 4
      emails/reset_email.html

3
api/password_reset.js

@ -11,7 +11,6 @@ const RESET_MAX = 10;
export const post = async (req, res) => {
const api = new API(req, res);
const { email, code, password, password_repeat, finalize} = req.body;
assert(email, "email is required.");
@ -27,7 +26,7 @@ export const post = async (req, res) => {
// they have a code submitted, so check it
if(user.reset_count > RESET_MAX) {
return api.error(400, "Can't reset your password at this time.");
} else if(user.reset_code !== code) {
} else if(user.reset_code !== code.trim()) {
await User.update({id: user.id}, { reset_count: user.reset_count + 1 });
return api.error(400, "Reset code doesn't match.");
} else {

5
emails/invoice.html

@ -141,6 +141,11 @@ body {
text-align: center !important;
}
}
.button a {
color: #FFFF;
}
/* Attribute list ------------------------------ */
.attributes {

123
emails/receipt.html

@ -9,26 +9,26 @@
<title><%- company.name %> -- Receipt</title>
<style type="text/css" rel="stylesheet" media="all">
/* Base ------------------------------ */
body {
width: 100% !important;
height: 100%;
margin: 0;
-webkit-text-size-adjust: none;
}
a {
color: #3869D4;
}
a img {
border: none;
}
td {
word-break: break-word;
}
.preheader {
display: none !important;
visibility: hidden;
@ -41,13 +41,13 @@
overflow: hidden;
}
/* Type ------------------------------ */
body,
td,
th {
font-family: Helvetica, Arial, sans-serif;
}
h1 {
margin-top: 0;
color: #333333;
@ -55,7 +55,7 @@
font-weight: bold;
text-align: left;
}
h2 {
margin-top: 0;
color: #333333;
@ -63,7 +63,7 @@
font-weight: bold;
text-align: left;
}
h3 {
margin-top: 0;
color: #333333;
@ -71,12 +71,12 @@
font-weight: bold;
text-align: left;
}
td,
th {
font-size: 16px;
}
p,
ul,
ol,
@ -85,25 +85,25 @@
font-size: 16px;
line-height: 1.625;
}
p.sub {
font-size: 13px;
}
/* Utilities ------------------------------ */
.align-right {
text-align: right;
}
.align-left {
text-align: left;
}
.align-center {
text-align: center;
}
/* Buttons ------------------------------ */
.button {
background-color: #3869D4;
border-top: 10px solid #3869D4;
@ -118,7 +118,11 @@
-webkit-text-size-adjust: none;
box-sizing: border-box;
}
.button a {
color: #FFFF;
}
.button--green {
background-color: #22BC66;
border-top: 10px solid #22BC66;
@ -126,7 +130,7 @@
border-bottom: 10px solid #22BC66;
border-left: 18px solid #22BC66;
}
.button--red {
background-color: #FF6136;
border-top: 10px solid #FF6136;
@ -134,7 +138,7 @@
border-bottom: 10px solid #FF6136;
border-left: 18px solid #FF6136;
}
@media only screen and (max-width: 500px) {
.button {
width: 100% !important;
@ -142,21 +146,21 @@
}
}
/* Attribute list ------------------------------ */
.attributes {
margin: 0 0 21px;
}
.attributes_content {
background-color: #F4F4F7;
padding: 16px;
}
.attributes_item {
padding: 0;
}
/* Related Items ------------------------------ */
.related {
width: 100%;
margin: 0;
@ -165,31 +169,31 @@
-premailer-cellpadding: 0;
-premailer-cellspacing: 0;
}
.related_item {
padding: 10px 0;
color: #CBCCCF;
font-size: 15px;
line-height: 18px;
}
.related_item-title {
display: block;
margin: .5em 0 0;
}
.related_item-thumb {
display: block;
padding-bottom: 10px;
}
.related_heading {
border-top: 1px solid #CBCCCF;
text-align: center;
padding: 25px 0 10px;
}
/* Discount Code ------------------------------ */
.discount {
width: 100%;
margin: 0;
@ -200,33 +204,33 @@
background-color: #F4F4F7;
border: 2px dashed #CBCCCF;
}
.discount_heading {
text-align: center;
}
.discount_body {
text-align: center;
font-size: 15px;
}
/* Social Icons ------------------------------ */
.social {
width: auto;
}
.social td {
padding: 0;
width: auto;
}
.social_icon {
height: 20px;
margin: 0 8px 10px 8px;
padding: 0;
}
/* Data table ------------------------------ */
.purchase {
width: 100%;
margin: 0;
@ -235,7 +239,7 @@
-premailer-cellpadding: 0;
-premailer-cellspacing: 0;
}
.purchase_content {
width: 100%;
margin: 0;
@ -244,54 +248,54 @@
-premailer-cellpadding: 0;
-premailer-cellspacing: 0;
}
.purchase_item {
padding: 10px 0;
color: #51545E;
font-size: 15px;
line-height: 18px;
}
.purchase_heading {
padding-bottom: 8px;
border-bottom: 1px solid #EAEAEC;
}
.purchase_heading p {
margin: 0;
color: #85878E;
font-size: 12px;
}
.purchase_footer {
padding-top: 15px;
border-top: 1px solid #EAEAEC;
}
.purchase_total {
margin: 0;
text-align: right;
font-weight: bold;
color: #333333;
}
.purchase_total--label {
padding: 0 15px 0 0;
}
body {
background-color: #F4F4F7;
color: #51545E;
}
p {
color: #51545E;
}
p.sub {
color: #6B6E76;
}
.email-wrapper {
width: 100%;
margin: 0;
@ -301,7 +305,7 @@
-premailer-cellspacing: 0;
background-color: #F4F4F7;
}
.email-content {
width: 100%;
margin: 0;
@ -311,16 +315,16 @@
-premailer-cellspacing: 0;
}
/* Masthead ----------------------- */
.email-masthead {
padding: 25px 0;
text-align: center;
}
.email-masthead_logo {
width: 94px;
}
.email-masthead_name {
font-size: 16px;
font-weight: bold;
@ -329,7 +333,7 @@
text-shadow: 0 1px 0 white;
}
/* Body ------------------------------ */
.email-body {
width: 100%;
margin: 0;
@ -339,7 +343,7 @@
-premailer-cellspacing: 0;
background-color: #FFFFFF;
}
.email-body_inner {
width: 570px;
margin: 0 auto;
@ -349,7 +353,7 @@
-premailer-cellspacing: 0;
background-color: #FFFFFF;
}
.email-footer {
width: 570px;
margin: 0 auto;
@ -360,11 +364,11 @@
text-align: center;
font-size: 7px;
}
.email-footer p {
color: #6B6E76;
}
.body-action {
width: 100%;
margin: 30px auto;
@ -374,23 +378,23 @@
-premailer-cellspacing: 0;
text-align: center;
}
.body-sub {
border-top: 1px solid #EAEAEC;
}
.content-cell {
padding: 35px;
}
/*Media Queries ------------------------------ */
@media only screen and (max-width: 600px) {
.email-body_inner,
.email-footer {
width: 100% !important;
}
}
@media (prefers-color-scheme: dark) {
body,
.email-body,
@ -419,7 +423,7 @@
text-shadow: none !important;
}
}
:root {
color-scheme: light dark;
supported-color-schemes: light dark;
@ -550,4 +554,3 @@
</table>
</body>
</html>

4
emails/register_email.html

@ -119,6 +119,10 @@ body {
box-sizing: border-box;
}
.button a {
color: #FFFF;
}
.button--green {
background-color: #22BC66;
border-top: 10px solid #22BC66;

4
emails/reset_email.html

@ -119,6 +119,10 @@
box-sizing: border-box;
}
.button a {
color: #FFFF;
}
.button--green {
background-color: #22BC66;
border-top: 10px solid #22BC66;

Loading…
Cancel
Save