From 6e3f28e770f5982d9de782e8b477b67dabe2476d Mon Sep 17 00:00:00 2001 From: Mrugesh Mohapatra Date: Sun, 17 Sep 2017 14:22:34 +0530 Subject: [PATCH] fix(sign-up): Update page for clear onboarding path Closes #10407 --- server/boot/user.js | 13 +------ server/views/account/email-signin.jade | 2 +- server/views/account/signin.jade | 52 -------------------------- 3 files changed, 3 insertions(+), 64 deletions(-) delete mode 100644 server/views/account/signin.jade diff --git a/server/boot/user.js b/server/boot/user.js index 13148734f2..e167481e9d 100644 --- a/server/boot/user.js +++ b/server/boot/user.js @@ -163,8 +163,8 @@ module.exports = function(app) { router.get('/logout', function(req, res) { res.redirect(301, '/signout'); }); - router.get('/signup', getSignin); - router.get('/signin', getSignin); + router.get('/signup', getEmailSignin); + router.get('/signin', getEmailSignin); router.get('/signout', signout); router.get('/email-signin', getEmailSignin); router.get('/deprecated-signin', getDepSignin); @@ -240,15 +240,6 @@ module.exports = function(app) { app.use('/:lang', router); app.use(api); - function getSignin(req, res) { - if (req.user) { - return res.redirect('/'); - } - return res.render('account/signin', { - title: 'Sign in to freeCodeCamp' - }); - } - const defaultErrorMsg = [ 'Oops, something is not right, please request a ', 'fresh link to sign in / sign up.' ].join(''); diff --git a/server/views/account/email-signin.jade b/server/views/account/email-signin.jade index b90ffee1fa..7e63b3e016 100644 --- a/server/views/account/email-signin.jade +++ b/server/views/account/email-signin.jade @@ -31,7 +31,7 @@ block content | using your existing email with us, if you already have an account. br p.text-center - a(href="/signin") Or click here if you want to sign in with other options. + a(href="/deprecated-signin") Or click here if you want to sign in with other options. script. $(document).ready(function() { diff --git a/server/views/account/signin.jade b/server/views/account/signin.jade deleted file mode 100644 index b73e8b8271..0000000000 --- a/server/views/account/signin.jade +++ /dev/null @@ -1,52 +0,0 @@ -extends ../layout -block content - .text-center - h2 Welcome to freeCodeCamp! - br - .button-spacer - | Sign in or Sign up with one of these options: - a.btn.btn-lg.btn-block.btn-social.btn-primary(href='/email-signin') - i.fa.fa-envelope - | Continue with Email - a.btn.btn-lg.btn-block.btn-social.btn-github(href='/auth/github') - i.fa.fa-github - | Continue with GitHub - br - p - a(href="/deprecated-signin") Or click here if you previously signed up using a different method. - - script. - $(document).ready(function() { - var method = localStorage.getItem('lastSigninMethod'), - btnSelector = 'a.btn.btn-lg.btn-block.btn-social'; - if (method) { - try { - var obj = JSON.parse(method); - } catch(e) { - console.error('Invalid sign in object stored', method); - return; - } - $.each($(btnSelector), function(i, item) { - if ( - $(item).text() === obj.method && - $(item).hasClass(obj.methodClass) - ) { - $(item).addClass('active'); - $(item).attr('title', 'This is your last signin method'); - return false; - } - }); - } - - $(btnSelector).click(function() { - var obj = {}; - $(this).removeClass('active'); - obj.methodClass = $(this).attr('class').split(' ').pop(); - obj.method = $(this).text(); - if(obj.method === "Continue with Email" || obj.method === "Continue in with GitHub") { - localStorage.setItem('lastSigninMethod', JSON.stringify(obj)); - } else { - localStorage.removeItem('lastSigninMethod'); - } - }); - });