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..9ce4163c12 100644 --- a/server/views/account/signin.jade +++ b/server/views/account/signin.jade @@ -1,27 +1,32 @@ 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 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") Click here if you previously signed in using a different method. script. $(document).ready(function() {