From f24a85b070c7880c0f5b9340231bb2dc4e28d943 Mon Sep 17 00:00:00 2001 From: Kristopher Paulsen Date: Fri, 20 Dec 2019 15:49:50 -0700 Subject: [PATCH 1/6] renaming and password reset fix --- scripts/email-me.js | 34 +++++++++++++++++++ src/components/Adventure/YamlTracker.svelte | 1 - .../email/pre-defined/email-password-reset.js | 26 +++++++++----- .../browserStore/display-ads.js | 2 +- .../browserStore/index.js | 0 .../browserStore/main-adventure.js | 2 +- .../browserStore/preDefinedKeys.js | 0 src/lib/global-state-stores/index.js | 0 src/lib/{stores => }/status-tracking.js | 0 src/lib/utils.js | 16 --------- src/routes/landing.svelte | 1 + src/routes/password-reset.svelte | 14 ++++---- src/routes/story/[slug].svelte | 4 +-- src/routes/user/new.svelte | 2 +- 14 files changed, 63 insertions(+), 39 deletions(-) create mode 100644 scripts/email-me.js rename src/lib/{stores => global-state-stores}/browserStore/display-ads.js (92%) rename src/lib/{stores => global-state-stores}/browserStore/index.js (100%) rename src/lib/{stores => global-state-stores}/browserStore/main-adventure.js (95%) rename src/lib/{stores => global-state-stores}/browserStore/preDefinedKeys.js (100%) create mode 100644 src/lib/global-state-stores/index.js rename src/lib/{stores => }/status-tracking.js (100%) delete mode 100644 src/lib/utils.js diff --git a/scripts/email-me.js b/scripts/email-me.js new file mode 100644 index 00000000..7de7bc5a --- /dev/null +++ b/scripts/email-me.js @@ -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(); diff --git a/src/components/Adventure/YamlTracker.svelte b/src/components/Adventure/YamlTracker.svelte index 23c5b6eb..4c494661 100644 --- a/src/components/Adventure/YamlTracker.svelte +++ b/src/components/Adventure/YamlTracker.svelte @@ -1,7 +1,6 @@ -
+ {#if successMsg}

{successMsg}

{#if $page.query.token} diff --git a/src/routes/story/[slug].svelte b/src/routes/story/[slug].svelte index 622dcc03..23ebe0d1 100644 --- a/src/routes/story/[slug].svelte +++ b/src/routes/story/[slug].svelte @@ -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"; diff --git a/src/routes/user/new.svelte b/src/routes/user/new.svelte index 8004b820..d2b1a022 100644 --- a/src/routes/user/new.svelte +++ b/src/routes/user/new.svelte @@ -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"; From 5bc7a9b9e5fa8568342e6005c6aca141a8e32f5d Mon Sep 17 00:00:00 2001 From: Kristopher Paulsen Date: Fri, 20 Dec 2019 16:00:02 -0700 Subject: [PATCH 2/6] wrapping element for simpler resizing --- src/routes/user/new.svelte | 71 ++++++++++++++++++++------------------ 1 file changed, 38 insertions(+), 33 deletions(-) diff --git a/src/routes/user/new.svelte b/src/routes/user/new.svelte index d2b1a022..1ce30d9e 100644 --- a/src/routes/user/new.svelte +++ b/src/routes/user/new.svelte @@ -54,6 +54,11 @@ {#if successMsg}

{successMsg}

- {#if $page.query.token} - Click here to login - {/if} + return to login {:else if $page.query.token}

New Password

Try not to forget this one! From c5cc8746d329953ef1c2a6cd194ae9428c59929c Mon Sep 17 00:00:00 2001 From: Kristopher Paulsen Date: Fri, 20 Dec 2019 16:08:31 -0700 Subject: [PATCH 4/6] tests for victory --- cypress/integration/password-reset.spec.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cypress/integration/password-reset.spec.js b/cypress/integration/password-reset.spec.js index 87294aca..4e68d477 100644 --- a/cypress/integration/password-reset.spec.js +++ b/cypress/integration/password-reset.spec.js @@ -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"]') @@ -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/) }); }); From c7504cc95b08edbdc914766cfdd66cfb529b3637 Mon Sep 17 00:00:00 2001 From: Kristopher Paulsen Date: Fri, 20 Dec 2019 16:11:37 -0700 Subject: [PATCH 5/6] Thats just a helper script --- scripts/email-me.js | 34 ---------------------------------- 1 file changed, 34 deletions(-) delete mode 100644 scripts/email-me.js diff --git a/scripts/email-me.js b/scripts/email-me.js deleted file mode 100644 index 7de7bc5a..00000000 --- a/scripts/email-me.js +++ /dev/null @@ -1,34 +0,0 @@ -#!/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(); From e012583127633617cdedb9fd4d724f80280080a3 Mon Sep 17 00:00:00 2001 From: Kristopher Paulsen Date: Sat, 21 Dec 2019 07:00:53 -0700 Subject: [PATCH 6/6] Speeling fixes --- src/lib/email/pre-defined/email-password-reset.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/email/pre-defined/email-password-reset.js b/src/lib/email/pre-defined/email-password-reset.js index 95fde369..f4652ad7 100644 --- a/src/lib/email/pre-defined/email-password-reset.js +++ b/src/lib/email/pre-defined/email-password-reset.js @@ -8,10 +8,10 @@ export const emailPasswordReset = ({ }) => email({ to, from: 'noreply@turningpointtales.com', - subject: '[TurningPointTales] Please reset your password', + subject: 'TurningPointTales: Please reset your password', html: ` You forgot your password, didn't you? A tale as old as time.
-We're won't hold it against you. Forgive and forget.
+We won't hold it against you
Here's a link to reset your password.