Skip to content

Commit

Permalink
Update password reset email look (#8)
Browse files Browse the repository at this point in the history
* renaming and password reset fix

* wrapping element for simpler resizing

* give the user a route back to signin

* tests for victory

* Thats just a helper script

* Speeling fixes
  • Loading branch information
KristopherPaulsen authored Dec 21, 2019
1 parent 71e6905 commit 7c76fa8
Show file tree
Hide file tree
Showing 14 changed files with 76 additions and 75 deletions.
6 changes: 5 additions & 1 deletion cypress/integration/password-reset.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ describe("Password Reset Flow: Submit an email", () => {
cy.visit("/password-reset");
});

it("displays errors and success on reset flow", () => {
it("displays errors, success, and navigation on reset flow", () => {
cy.logIn()
.visit("/user/login")
.get('[data-cy="password-reset"]')
Expand All @@ -24,6 +24,10 @@ describe("Password Reset Flow: Submit an email", () => {
.click();

cy.get("h3").should("contain", "You have been sent an email");

cy.contains('return to login')
.click()
.url().should('match', /user\/login/)
});
});

Expand Down
1 change: 0 additions & 1 deletion src/components/Adventure/YamlTracker.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<script>
import yaml from "js-yaml";
import AnimatedStoryNode from "./AnimatedStoryNode.svelte";
import { first } from "src/lib/utils";
const { keys } = Object;
Expand Down
26 changes: 17 additions & 9 deletions src/lib/email/pre-defined/email-password-reset.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,21 @@ export const emailPasswordReset = ({
}) => email({
to,
from: '[email protected]',
subject: 'Password reset request',
subject: 'TurningPointTales: Please reset your password',
html: `
You have requested a password reset.
<br/>
If this was made in error, disregard.
<br/>
<br/>
<a href="${resetUrl}" >Click here to reset your password</a>
`,
});
You forgot your password, didn't you? A tale as old as time.<br/>
We won't hold it against you<br/>
Here's a link to reset your password.
<br/>
<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="${resetUrl}" >Password reset link</a>
<br/>
<br/>
If you didn't request a password reset, please ignore this email.
<br />
<br/>
Adventure safely,
<br/>
- The Team At Turning Point Tales
`,
});
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {
browserStore
} from '../browserStore';
} from './index';
import {
AD_SEEN
} from './preDefinedKeys';
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import sha256 from 'crypto-js/sha256'
import {
browserStore
} from '../browserStore';
} from './index';
import {
MAIN_ADVENTURE
} from './preDefinedKeys';
Expand Down
Empty file.
File renamed without changes.
16 changes: 0 additions & 16 deletions src/lib/utils.js

This file was deleted.

1 change: 1 addition & 0 deletions src/routes/landing.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
}
img {
width: 100%;
display: flex;
max-width: 500px;
margin: 0 auto;
Expand Down
20 changes: 10 additions & 10 deletions src/routes/password-reset.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import * as sapper from "@sapper/app";
import { fade } from "../lib/Transition";
import { axios } from "src/lib/axios";
import { statusTracking } from "../lib/stores/status-tracking";
import { statusTracking } from "../lib/status-tracking";
import { Input, Form } from "src/components/Form";
import Button from "src/components/Button.svelte";
Expand Down Expand Up @@ -41,17 +41,17 @@
</script>

<style>
:global(.password-reset) {
:global(.form) {
width: 100%;
max-width: 50ch;
}
:global(.password-reset .button) {
:global(.form .button) {
width: 100%;
margin: 32px auto auto auto;
}
:global(.password-reset .input) {
:global(.form .input) {
width: 100%;
}
Expand All @@ -60,17 +60,17 @@
margin: 8px 0 8px 0;
}
a {
text-align: left;
a { text-align: left; }
h3 {
margin-bottom: 32px;
}
</style>

<Form className="password-reset">
<Form>
{#if successMsg}
<h3 in:fade>{successMsg}</h3>
{#if $page.query.token}
<a href="/user/login">Click here to login</a>
{/if}
<a href="/user/login">return to login</a>
{:else if $page.query.token}
<h2>New Password</h2>
<small>Try not to forget this one!</small>
Expand Down
4 changes: 2 additions & 2 deletions src/routes/story/[slug].svelte
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
import BadgePopup from "src/routes/story/_BadgePopup.svelte";
import Button from "src/components/Button.svelte";
import { Logger } from "src/lib/client/logger";
import { adStore } from "src/lib/stores/browserStore/display-ads";
import { adStore } from "src/lib/global-state-stores/browserStore/display-ads";
import { fetchCsrf } from "src/lib/client/csrf";
import { mainAdventure } from "src/lib/stores/browserStore/main-adventure";
import { mainAdventure } from "src/lib/global-state-stores/browserStore/main-adventure";
import { onMount } from "svelte";
import { goto, stores } from "@sapper/app";
import { userSubscribed } from "src/lib/client/user";
Expand Down
73 changes: 39 additions & 34 deletions src/routes/user/new.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import * as sapper from "@sapper/app";
import { axios } from "src/lib/axios";
import { fade } from "src/lib/Transition";
import { statusTracking } from "src/lib/stores/status-tracking";
import { statusTracking } from "src/lib/status-tracking";
import { Input, Form, Checkbox } from "src/components/Form";
import Button from "src/components/Button.svelte";
import FAQ from "src/routes/faq.svelte";
Expand Down Expand Up @@ -54,6 +54,11 @@
</script>

<style>
.user-new {
max-width: 720px;
margin: auto;
}
p {
text-align: left;
margin-bottom: 0;
Expand Down Expand Up @@ -82,36 +87,36 @@
<title>User Creation</title>
</svelte:head>

{#if $page.query.error === 'unknown'}
<section class="errors text">
<section class='user-new'>
{#if $page.query.error === 'unknown'}
<article class="errors">
<p>
An unknown error occurred! Please try again or contact
<a href="mailto:[email protected]">
[email protected]
</a>
.
</p>
</article>
{/if}

<article>
<h1>Let's create your user!</h1>

<p>
An unknown error occurred! Please try again or contact
<a href="mailto:[email protected]">
[email protected]
</a>
.
Creating an account grants you access to the entire library of adventures.
We use your email and name, which we only share for things like payments, to
personalize the experience and send you exciting updates. In lieu of sharing
your data and browsing with a third party, we handcraft some interesting ads
or let you skip those entirely with a paid subscription.
</p>
</section>
{/if}

<section class="preamble text">
<h1>Let's create your user!</h1>

<p>
Creating an account grants you access to the entire library of adventures.
We use your email and name, which we only share for things like payments, to
personalize the experience and send you exciting updates. In lieu of sharing
your data and browsing with a third party, we handcraft some interesting ads
or let you skip those entirely with a paid subscription.
</p>

<p>
More questions? Check out our
<a href="/faq">FAQ.</a>
</p>
</section>

<section class="form text">
<p>
More questions? Check out our
<a href="/faq">FAQ.</a>
</p>
</article>

<Form on:submit="{handleSubmit}" bind:this="{form}">
{#if errorMsg}
<span class="error form-group">{errorMsg}</span>
Expand Down Expand Up @@ -177,11 +182,11 @@
Sign up
</Button>
</Form>
</section>

<section class="text">
<p>
If you already have an account with us, you can log in
<a href="/user/login">here.</a>
</p>
<article>
<p>
If you already have an account with us, you can log in
<a href="/user/login">here.</a>
</p>
</article>
</section>

0 comments on commit 7c76fa8

Please sign in to comment.