diff --git a/app.js b/app.js index 91ddccc89b..7cb41e734f 100644 --- a/app.js +++ b/app.js @@ -167,6 +167,7 @@ app.post('/completed_challenge', function(req, res) { /** * OAuth sign-in routes. */ + app.get('/auth/twitter', passport.authenticate('twitter')); app.get( '/auth/twitter/callback', @@ -192,6 +193,21 @@ app.get( res.redirect(req.session.returnTo || '/'); }); +app.get('/auth/facebook', passport.authenticate('facebook', { scope: ['email', 'user_location'] })); +app.get('/auth/facebook/callback', passport.authenticate('facebook', { successRedirect: '/',failureRedirect: '/login' }), function(req, res) { + res.redirect(req.session.returnTo || '/'); +}); + +app.get('/auth/github', passport.authenticate('github')); +app.get('/auth/github/callback', passport.authenticate('github', { successRedirect: '/',failureRedirect: '/login' }), function(req, res) { + res.redirect(req.session.returnTo || '/'); +}); + +app.get('/auth/google', passport.authenticate('google', { scope: 'profile email' })); +app.get('/auth/google/callback', passport.authenticate('google', { successRedirect: '/',failureRedirect: '/login' }), function(req, res) { + res.redirect(req.session.returnTo || '/'); +}); + /** * 500 Error Handler. */ @@ -210,59 +226,26 @@ app.listen(app.get('port'), function() { module.exports = app; - -/* :TODO: Add these. -app.get('/auth/instagram', passport.authenticate('instagram')); -app.get('/auth/instagram/callback', passport.authenticate('instagram', { successRedirect: '/',failureRedirect: '/login' }), function(req, res) { - res.redirect(req.session.returnTo || '/'); -}); -app.get('/auth/facebook', passport.authenticate('facebook', { scope: ['email', 'user_location'] })); -app.get('/auth/facebook/callback', passport.authenticate('facebook', { successRedirect: '/',failureRedirect: '/login' }), function(req, res) { - res.redirect(req.session.returnTo || '/'); -}); -app.get('/auth/github', passport.authenticate('github')); -app.get('/auth/github/callback', passport.authenticate('github', { successRedirect: '/',failureRedirect: '/login' }), function(req, res) { - res.redirect(req.session.returnTo || '/'); -}); -app.get('/auth/google', passport.authenticate('google', { scope: 'profile email' })); -app.get('/auth/google/callback', passport.authenticate('google', { successRedirect: '/',failureRedirect: '/login' }), function(req, res) { - res.redirect(req.session.returnTo || '/'); -}); - -app.get('/auth/foursquare', passport.authorize('foursquare')); -app.get('/auth/foursquare/callback', passport.authorize('foursquare', { failureRedirect: '/api' }), function(req, res) { - res.redirect('/api/foursquare'); -}); -app.get('/auth/tumblr', passport.authorize('tumblr')); -app.get('/auth/tumblr/callback', passport.authorize('tumblr', { failureRedirect: '/api' }), function(req, res) { - res.redirect('/api/tumblr'); -}); -app.get('/auth/venmo', passport.authorize('venmo', { scope: 'make_payments access_profile access_balance access_email access_phone' })); -app.get('/auth/venmo/callback', passport.authorize('venmo', { failureRedirect: '/api' }), function(req, res) { - res.redirect('/api/venmo'); -}); - -app.get('/api', apiController.getApi); -app.get('/api/lastfm', apiController.getLastfm); -app.get('/api/nyt', apiController.getNewYorkTimes); -app.get('/api/aviary', apiController.getAviary); -app.get('/api/steam', apiController.getSteam); -app.get('/api/stripe', apiController.getStripe); -app.post('/api/stripe', apiController.postStripe); -app.get('/api/scraping', apiController.getScraping); -app.get('/api/twilio', apiController.getTwilio); -app.post('/api/twilio', apiController.postTwilio); -app.get('/api/clockwork', apiController.getClockwork); -app.post('/api/clockwork', apiController.postClockwork); -app.get('/api/foursquare', passportConf.isAuthenticated, passportConf.isAuthorized, apiController.getFoursquare); -app.get('/api/tumblr', passportConf.isAuthenticated, passportConf.isAuthorized, apiController.getTumblr); -app.get('/api/facebook', passportConf.isAuthenticated, passportConf.isAuthorized, apiController.getFacebook); -app.get('/api/github', passportConf.isAuthenticated, passportConf.isAuthorized, apiController.getGithub); -app.get('/api/twitter', passportConf.isAuthenticated, passportConf.isAuthorized, apiController.getTwitter); -app.post('/api/twitter', passportConf.isAuthenticated, passportConf.isAuthorized, apiController.postTwitter); -app.get('/api/venmo', passportConf.isAuthenticated, passportConf.isAuthorized, apiController.getVenmo); -app.post('/api/venmo', passportConf.isAuthenticated, passportConf.isAuthorized, apiController.postVenmo); -app.get('/api/linkedin', passportConf.isAuthenticated, passportConf.isAuthorized, apiController.getLinkedin); -app.get('/api/instagram', passportConf.isAuthenticated, passportConf.isAuthorized, apiController.getInstagram); -app.get('/api/yahoo', apiController.getYahoo); -*/ +//app.get('/api', apiController.getApi); +//app.get('/api/lastfm', apiController.getLastfm); +//app.get('/api/nyt', apiController.getNewYorkTimes); +//app.get('/api/aviary', apiController.getAviary); +//app.get('/api/steam', apiController.getSteam); +//app.get('/api/stripe', apiController.getStripe); +//app.post('/api/stripe', apiController.postStripe); +//app.get('/api/scraping', apiController.getScraping); +//app.get('/api/twilio', apiController.getTwilio); +//app.post('/api/twilio', apiController.postTwilio); +//app.get('/api/clockwork', apiController.getClockwork); +//app.post('/api/clockwork', apiController.postClockwork); +//app.get('/api/foursquare', passportConf.isAuthenticated, passportConf.isAuthorized, apiController.getFoursquare); +//app.get('/api/tumblr', passportConf.isAuthenticated, passportConf.isAuthorized, apiController.getTumblr); +//app.get('/api/facebook', passportConf.isAuthenticated, passportConf.isAuthorized, apiController.getFacebook); +//app.get('/api/github', passportConf.isAuthenticated, passportConf.isAuthorized, apiController.getGithub); +//app.get('/api/twitter', passportConf.isAuthenticated, passportConf.isAuthorized, apiController.getTwitter); +//app.post('/api/twitter', passportConf.isAuthenticated, passportConf.isAuthorized, apiController.postTwitter); +//app.get('/api/venmo', passportConf.isAuthenticated, passportConf.isAuthorized, apiController.getVenmo); +//app.post('/api/venmo', passportConf.isAuthenticated, passportConf.isAuthorized, apiController.postVenmo); +//app.get('/api/linkedin', passportConf.isAuthenticated, passportConf.isAuthorized, apiController.getLinkedin); +//app.get('/api/instagram', passportConf.isAuthenticated, passportConf.isAuthorized, apiController.getInstagram); +//app.get('/api/yahoo', apiController.getYahoo); diff --git a/models/User.js b/models/User.js index dc92d108e0..c0be17eb0e 100644 --- a/models/User.js +++ b/models/User.js @@ -4,14 +4,14 @@ var mongoose = require('mongoose'); var userSchema = new mongoose.Schema({ email: { type: String, unique: true, lowercase: true }, -// password: String, + password: String, - linkedin: String, facebook: String, - github: String, twitter: String, google: String, + github: String, instagram: String, + linkedin: String, tokens: Array, challengesCompleted: { type: Array, default: [] }, diff --git a/public/css/main.less b/public/css/main.less index 481ef4a4e2..bc41e59963 100644 --- a/public/css/main.less +++ b/public/css/main.less @@ -241,6 +241,7 @@ ul { .btn-social { width: 250px; + margin: auto; } .navbar { diff --git a/views/account/login.jade b/views/account/login.jade index 38dd1a9ac0..1c422c3c11 100644 --- a/views/account/login.jade +++ b/views/account/login.jade @@ -1,8 +1,23 @@ extends ../layout block content - .panel - .text-center - h3 Sign in to Free Code Camp with your email/password or any of these social network accounts: + .jumbotron.text-center + h2 Use any of these accounts to Sign up or Sign in to Free Code Camp: + a.btn.btn-lg.btn-block.btn-facebook.btn-social(href='/auth/facebook') + i.fa.fa-facebook + | Sign in with Facebook + a.btn.btn-lg.btn-block.btn-twitter.btn-social(href='/auth/twitter') + i.fa.fa-twitter + | Sign in with Twitter + a.btn.btn-lg.btn-block.btn-google-plus.btn-social(href='/auth/google') + i.fa.fa-google-plus + | Sign in with Google + a.btn.btn-lg.btn-block.btn-github.btn-social(href='/auth/github') + i.fa.fa-github + | Sign in with GitHub + a.btn.btn-lg.btn-block.btn-linkedin.btn-social(href='/auth/linkedin') + i.fa.fa-linkedin + | Sign in with LinkedIn + h2 ... or Sign In or Sign up with an email and password: form(method='POST') input(type='hidden', name='_csrf', value=_csrf) .col-sm-8.col-sm-offset-2 @@ -17,22 +32,12 @@ block content span.ion-android-hand | Login a.btn.btn-link(href='/forgot') Forgot your password? - hr - a.btn.btn-block.btn-facebook.btn-social(href='/auth/facebook') - i.fa.fa-facebook - | Sign in with Facebook - a.btn.btn-block.btn-twitter.btn-social(href='/auth/twitter') - i.fa.fa-twitter - | Sign in with Twitter - a.btn.btn-block.btn-google-plus.btn-social(href='/auth/google') - i.fa.fa-google-plus - | Sign in with Google - a.btn.btn-block.btn-github.btn-social(href='/auth/github') - i.fa.fa-github - | Sign in with GitHub - a.btn.btn-block.btn-linkedin.btn-social(href='/auth/linkedin') - i.fa.fa-linkedin - | Sign in with LinkedIn - a.btn.btn-block.btn-instagram.btn-social(href='/auth/instagram') - i.fa.fa-instagram - | Sign in with Instagram + br + br + br + br + br + br + br + br + br