Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update password reset email look #8

Merged
merged 6 commits into from
Dec 21, 2019
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
34 changes: 34 additions & 0 deletions scripts/email-me.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/usr/bin/env node
const yargs = require('yargs')
const fs = require('fs');
const path = require('path');
const { spawn, spawnSync } = require('child_process');
const { emailPasswordReset } = require('../src/lib/email/pre-defined/email-password-reset.js');

// -----------------------------------------------------------------------------

const main = async () => {
const args = yargs
.usage('example usage')
.option('to', {
alias: 'to',
type: 'string',
describe: "who to send the email to, duh!",
})
.option('reset-url', {
alias: 'to',
type: 'string',
describe: "who to send the email to, duh!",
})
.epilogue('example epilogue')
.argv;

const result = await emailPasswordReset({
to: args.to,
resetUrl: args.resetUrl,
});

console.log(result);
}

main();
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',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@krwenholz
@cody-h2wib

Want your opinion on the markup / copy here, and if there's anything
you'd word differently. I based this on a generalized group of reset password emails
from a couple sites.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nit] I'd say TurningPointTales: for a subject.

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're won't hold it against you. Forgive and forget.<br/>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/'re//
s/Forgive and forget.// (too lengthy with everything else)

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
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">
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll have to look into this later, but svelte does NOT like you doing this.
This is a react pattern that might not work the way I think it does in svelte.
It basically wipes away all the auto-generated classes on the element (which was causing this element to bounce around once you typed text).

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ruh roh.....

<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>