From aeea02d7fc0756561c7145635032e73bd37f36cd Mon Sep 17 00:00:00 2001 From: Mrugesh Mohapatra Date: Mon, 18 Apr 2016 15:43:35 +0000 Subject: [PATCH 1/2] Update the Sign in and Sign up Pages --- server/boot/user.js | 10 ++++ server/views/account/deprecated-signin.jade | 56 +++++++++++++++++++++ server/views/account/show.jade | 2 +- server/views/account/signin.jade | 27 +++++----- 4 files changed, 79 insertions(+), 16 deletions(-) create mode 100644 server/views/account/deprecated-signin.jade diff --git a/server/boot/user.js b/server/boot/user.js index 8d9984e2ab..3f3e57b049 100644 --- a/server/boot/user.js +++ b/server/boot/user.js @@ -148,6 +148,7 @@ module.exports = function(app) { router.post('/reset-password', postReset); router.get('/email-signup', getEmailSignup); router.get('/email-signin', getEmailSignin); + router.get('/deprecated-signin', getDepSignin); router.get( '/toggle-lockdown-mode', sendNonUserToMap, @@ -225,6 +226,15 @@ module.exports = function(app) { res.redirect('/'); } + function getDepSignin(req, res) { + if (req.user) { + return res.redirect('/'); + } + return res.render('account/deprecated-signin', { + title: 'Sign in to Free Code Camp using a Deprecated Login' + }); + } + function getEmailSignin(req, res) { if (req.user) { return res.redirect('/'); diff --git a/server/views/account/deprecated-signin.jade b/server/views/account/deprecated-signin.jade new file mode 100644 index 0000000000..57ebf22aab --- /dev/null +++ b/server/views/account/deprecated-signin.jade @@ -0,0 +1,56 @@ +extends ../layout +block content + .text-center + h2 Sign in with one of these options if you used them as your original login methods : + br + a.btn.btn-lg.btn-block.btn-social.btn-facebook(href='/auth/facebook') + i.fa.fa-facebook + | Sign in with Facebook + a.btn.btn-lg.btn-block.btn-social.btn-google(href='/auth/google') + i.fa.fa-google + | Sign in with Google + a.btn.btn-lg.btn-block.btn-social.btn-linkedin(href='/auth/linkedin') + i.fa.fa-linkedin + | Sign in with LinkedIn + a.btn.btn-lg.btn-block.btn-social.btn-twitter(href='/auth/twitter') + i.fa.fa-twitter + | Sign in with Twitter + br + p + strong IMPORTANT NOTICE + br + em These options are under deprecation and will be removed soon. + br + em After you are signed in, go to the settings page and add GitHub and/or Email as your sign in option + + 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).attr('href') === obj.methodLink && + $(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.methodLink = $(this).attr('href'); + localStorage.setItem('lastSigninMethod', JSON.stringify(obj)); + }); + }); diff --git a/server/views/account/show.jade b/server/views/account/show.jade index 568fd5ea4d..53375e3d2b 100644 --- a/server/views/account/show.jade +++ b/server/views/account/show.jade @@ -14,7 +14,7 @@ block content a.btn.btn-lg.btn-block.btn-primary.btn-link-social(href='/settings') | Update your settings .col-xs-12 - a.btn.btn-lg.btn-block.btn-primary.btn-link-social(href='/logout') + a.btn.btn-lg.btn-block.btn-primary.btn-link-social(href='/signout') | Sign me out of Free Code Camp .col-xs-12 a.btn.btn-lg.btn-block.btn-primary.btn-link-social(href='mailto:team@freecodecamp.com') diff --git a/server/views/account/signin.jade b/server/views/account/signin.jade index deda558ea7..ee5c28588c 100644 --- a/server/views/account/signin.jade +++ b/server/views/account/signin.jade @@ -2,26 +2,23 @@ extends ../layout block content .text-center h2 Sign in with one of these options: + a.btn.btn-lg.btn-block.btn-social.btn-primary(href='/email-signin') + i.fa.fa-envelope + | Sign in with Email a.btn.btn-lg.btn-block.btn-social.btn-github(href='/auth/github') i.fa.fa-github | Sign in with GitHub - a.btn.btn-lg.btn-block.btn-social.btn-facebook(href='/auth/facebook') - i.fa.fa-facebook - | Sign in with Facebook - a.btn.btn-lg.btn-block.btn-social.btn-google(href='/auth/google') - i.fa.fa-google - | Sign in with Google - a.btn.btn-lg.btn-block.btn-social.btn-linkedin(href='/auth/linkedin') - i.fa.fa-linkedin - | Sign in with LinkedIn - a.btn.btn-lg.btn-block.btn-social.btn-twitter(href='/auth/twitter') - i.fa.fa-twitter - | Sign in with Twitter br p - a(href="/email-signup") Or sign up using your email address here. - p - a(href="/email-signin") If you originally signed up using your email address, you can sign in here. + a(href="/deprecated-signin") Or click here to signin with one of the deprecated methods. + + h2 New to Free Code Camp ? Sign up now: + a.btn.btn-lg.btn-block.btn-social.btn-primary(href='/email-signup') + i.fa.fa-envelope + | Sign up with Email + a.btn.btn-lg.btn-block.btn-social.btn-github(href='/auth/github') + i.fa.fa-github + | Sign up with GitHub script. $(document).ready(function() { From 6c291148d4849483f7659fafae52c926c4df04ce Mon Sep 17 00:00:00 2001 From: Quincy Larson Date: Fri, 22 Apr 2016 12:26:02 -0700 Subject: [PATCH 2/2] improve the ux of the signin page --- server/views/account/signin.jade | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/server/views/account/signin.jade b/server/views/account/signin.jade index ee5c28588c..9ce4163c12 100644 --- a/server/views/account/signin.jade +++ b/server/views/account/signin.jade @@ -1,7 +1,23 @@ extends ../layout block content .text-center - h2 Sign in with one of these options: + h2 New to Free Code Camp? + br + .button-spacer + | Sign up now: + a.btn.btn-lg.btn-block.btn-social.btn-primary(href='/email-signup') + i.fa.fa-envelope + | Sign up with Email + a.btn.btn-lg.btn-block.btn-social.btn-github(href='/auth/github') + i.fa.fa-github + | Sign up with GitHub + .spacer + hr + .spacer + h2 Are you a returning camper? + br + .button-spacer + | Sign in with one of these options: a.btn.btn-lg.btn-block.btn-social.btn-primary(href='/email-signin') i.fa.fa-envelope | Sign in with Email @@ -10,15 +26,7 @@ block content | Sign in with GitHub br p - a(href="/deprecated-signin") Or click here to signin with one of the deprecated methods. - - h2 New to Free Code Camp ? Sign up now: - a.btn.btn-lg.btn-block.btn-social.btn-primary(href='/email-signup') - i.fa.fa-envelope - | Sign up with Email - a.btn.btn-lg.btn-block.btn-social.btn-github(href='/auth/github') - i.fa.fa-github - | Sign up with GitHub + a(href="/deprecated-signin") Click here if you previously signed in using a different method. script. $(document).ready(function() {