From 564f4c118051650aa8868a6c390b5f758774caf7 Mon Sep 17 00:00:00 2001 From: Berkeley Martinez Date: Thu, 2 Jun 2016 13:01:32 -0700 Subject: [PATCH] Update email info copy --- common/models/user.js | 32 +++++-------- server/utils/middleware.js | 15 ++---- server/views/emails/a-extend-user-welcome.ejs | 47 +++++++++---------- server/views/emails/user-email-verify.ejs | 29 ++++++------ 4 files changed, 53 insertions(+), 70 deletions(-) diff --git a/common/models/user.js b/common/models/user.js index 246a2984d1..77d9874df2 100644 --- a/common/models/user.js +++ b/common/models/user.js @@ -366,27 +366,19 @@ module.exports = function(User) { 'user-email-verify.ejs' ) }; - return this.verify(mailOptions).then( - (data) => { - if (data) { - return Promise.resolve( - dedent` - Your email has been updated successfully, Please - follow the link we sent you, to confirm. - `); - } - return Promise.reject( - 'Oops, something went wrong, please try again later' - ); - }, - (error) => { - debug(error); - return Promise.reject( - 'Oops, something went wrong, please try again later' - ); - } + return this.verify(mailOptions); + }) + .map(() => dedent` + Please check your email. + We sent you a link that you can click to verify your email address. + `) + .catch(error => { + debug(error); + return Observable.throw( + 'Oops, something went wrong, please try again later' ); - }).toPromise(); + }) + .toPromise(); }); }; diff --git a/server/utils/middleware.js b/server/utils/middleware.js index 51fe4e45ae..7ec17defdf 100644 --- a/server/utils/middleware.js +++ b/server/utils/middleware.js @@ -1,5 +1,3 @@ -import dedent from 'dedent'; - export function ifNoUserRedirectTo(url, message, type = 'errors') { return function(req, res, next) { const { path } = req; @@ -38,15 +36,10 @@ export function flashIfNotVerified(req, res, next) { } const email = req.user.email; const emailVerified = req.user.emailVerified; - if (!email) { - req.flash('info', { msg: - dedent `Please update your email address when you get a moment in - your Settings Page.` - }); - } else if (!emailVerified) { - req.flash('info', { msg: - dedent `We have your email address with us, but its not yet verified. - Please follow the link we sent you, when you get a moment.` + if (!email || !emailVerified) { + req.flash('info', { + msg: 'Please verify your email address ' + + 'here.' }); } return next(); diff --git a/server/views/emails/a-extend-user-welcome.ejs b/server/views/emails/a-extend-user-welcome.ejs index be361302e2..97b0f159cd 100644 --- a/server/views/emails/a-extend-user-welcome.ejs +++ b/server/views/emails/a-extend-user-welcome.ejs @@ -1,24 +1,23 @@ -

- Greetings from San Francisco! -

-

- Thank you for joining our community. -

-

- Please verify your email by following the link below: -

-

- <%= verifyHref %> -

-

- Feel free to email us at this address if you have any questions about Free Code Camp. -

-

- And if you have a moment, check out our blog: https://medium.freecodecamp.com. -

-

- Good luck with the challenges! -

-

- - the Free Code Camp Team. -

+Greetings from San Francisco! +
+
+Thank you for joining our community. +
+
+Please verify your email by following the link below: +
+
+<%= verifyHref %> +
+
+Feel free to email us at this address if you have any questions about Free Code Camp. +
+
+And if you have a moment, check out our blog: https://medium.freecodecamp.com. +
+
+Good luck with the challenges! +
+
+
+- the Free Code Camp Team. diff --git a/server/views/emails/user-email-verify.ejs b/server/views/emails/user-email-verify.ejs index 1df3b84627..6263a89b1f 100644 --- a/server/views/emails/user-email-verify.ejs +++ b/server/views/emails/user-email-verify.ejs @@ -1,15 +1,14 @@ -

- Thank you, for updating you contact details. -

-

- Please verify your email by following the link below: -

-

- <%= verifyHref %> -

-

- Feel free to email us at this address if you have any questions about Free Code Camp. -

-

- - the Free Code Camp Team. -

+Thank you, for updating you contact details. +
+
+Please verify your email by following the link below: +
+
+<%= verifyHref %> +
+
+Feel free to email us at this address if you have any questions about Free Code Camp. +
+
+
+- the Free Code Camp Team.