start adding omniauth functionality back in and debugging in production
This commit is contained in:
95
app.js
95
app.js
@ -167,6 +167,7 @@ app.post('/completed_challenge', function(req, res) {
|
|||||||
/**
|
/**
|
||||||
* OAuth sign-in routes.
|
* OAuth sign-in routes.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
app.get('/auth/twitter', passport.authenticate('twitter'));
|
app.get('/auth/twitter', passport.authenticate('twitter'));
|
||||||
app.get(
|
app.get(
|
||||||
'/auth/twitter/callback',
|
'/auth/twitter/callback',
|
||||||
@ -192,6 +193,21 @@ app.get(
|
|||||||
res.redirect(req.session.returnTo || '/');
|
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.
|
* 500 Error Handler.
|
||||||
*/
|
*/
|
||||||
@ -210,59 +226,26 @@ app.listen(app.get('port'), function() {
|
|||||||
|
|
||||||
module.exports = app;
|
module.exports = app;
|
||||||
|
|
||||||
|
//app.get('/api', apiController.getApi);
|
||||||
/* :TODO: Add these.
|
//app.get('/api/lastfm', apiController.getLastfm);
|
||||||
app.get('/auth/instagram', passport.authenticate('instagram'));
|
//app.get('/api/nyt', apiController.getNewYorkTimes);
|
||||||
app.get('/auth/instagram/callback', passport.authenticate('instagram', { successRedirect: '/',failureRedirect: '/login' }), function(req, res) {
|
//app.get('/api/aviary', apiController.getAviary);
|
||||||
res.redirect(req.session.returnTo || '/');
|
//app.get('/api/steam', apiController.getSteam);
|
||||||
});
|
//app.get('/api/stripe', apiController.getStripe);
|
||||||
app.get('/auth/facebook', passport.authenticate('facebook', { scope: ['email', 'user_location'] }));
|
//app.post('/api/stripe', apiController.postStripe);
|
||||||
app.get('/auth/facebook/callback', passport.authenticate('facebook', { successRedirect: '/',failureRedirect: '/login' }), function(req, res) {
|
//app.get('/api/scraping', apiController.getScraping);
|
||||||
res.redirect(req.session.returnTo || '/');
|
//app.get('/api/twilio', apiController.getTwilio);
|
||||||
});
|
//app.post('/api/twilio', apiController.postTwilio);
|
||||||
app.get('/auth/github', passport.authenticate('github'));
|
//app.get('/api/clockwork', apiController.getClockwork);
|
||||||
app.get('/auth/github/callback', passport.authenticate('github', { successRedirect: '/',failureRedirect: '/login' }), function(req, res) {
|
//app.post('/api/clockwork', apiController.postClockwork);
|
||||||
res.redirect(req.session.returnTo || '/');
|
//app.get('/api/foursquare', passportConf.isAuthenticated, passportConf.isAuthorized, apiController.getFoursquare);
|
||||||
});
|
//app.get('/api/tumblr', passportConf.isAuthenticated, passportConf.isAuthorized, apiController.getTumblr);
|
||||||
app.get('/auth/google', passport.authenticate('google', { scope: 'profile email' }));
|
//app.get('/api/facebook', passportConf.isAuthenticated, passportConf.isAuthorized, apiController.getFacebook);
|
||||||
app.get('/auth/google/callback', passport.authenticate('google', { successRedirect: '/',failureRedirect: '/login' }), function(req, res) {
|
//app.get('/api/github', passportConf.isAuthenticated, passportConf.isAuthorized, apiController.getGithub);
|
||||||
res.redirect(req.session.returnTo || '/');
|
//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.get('/auth/foursquare', passport.authorize('foursquare'));
|
//app.post('/api/venmo', passportConf.isAuthenticated, passportConf.isAuthorized, apiController.postVenmo);
|
||||||
app.get('/auth/foursquare/callback', passport.authorize('foursquare', { failureRedirect: '/api' }), function(req, res) {
|
//app.get('/api/linkedin', passportConf.isAuthenticated, passportConf.isAuthorized, apiController.getLinkedin);
|
||||||
res.redirect('/api/foursquare');
|
//app.get('/api/instagram', passportConf.isAuthenticated, passportConf.isAuthorized, apiController.getInstagram);
|
||||||
});
|
//app.get('/api/yahoo', apiController.getYahoo);
|
||||||
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);
|
|
||||||
*/
|
|
||||||
|
@ -4,14 +4,14 @@ var mongoose = require('mongoose');
|
|||||||
|
|
||||||
var userSchema = new mongoose.Schema({
|
var userSchema = new mongoose.Schema({
|
||||||
email: { type: String, unique: true, lowercase: true },
|
email: { type: String, unique: true, lowercase: true },
|
||||||
// password: String,
|
password: String,
|
||||||
|
|
||||||
linkedin: String,
|
|
||||||
facebook: String,
|
facebook: String,
|
||||||
github: String,
|
|
||||||
twitter: String,
|
twitter: String,
|
||||||
google: String,
|
google: String,
|
||||||
|
github: String,
|
||||||
instagram: String,
|
instagram: String,
|
||||||
|
linkedin: String,
|
||||||
tokens: Array,
|
tokens: Array,
|
||||||
challengesCompleted: { type: Array, default: [] },
|
challengesCompleted: { type: Array, default: [] },
|
||||||
|
|
||||||
|
@ -241,6 +241,7 @@ ul {
|
|||||||
|
|
||||||
.btn-social {
|
.btn-social {
|
||||||
width: 250px;
|
width: 250px;
|
||||||
|
margin: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.navbar {
|
.navbar {
|
||||||
|
@ -1,8 +1,23 @@
|
|||||||
extends ../layout
|
extends ../layout
|
||||||
block content
|
block content
|
||||||
.panel
|
.jumbotron.text-center
|
||||||
.text-center
|
h2 Use any of these accounts to Sign up or Sign in to Free Code Camp:
|
||||||
h3 Sign in to Free Code Camp with your email/password or any of these social network accounts:
|
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')
|
form(method='POST')
|
||||||
input(type='hidden', name='_csrf', value=_csrf)
|
input(type='hidden', name='_csrf', value=_csrf)
|
||||||
.col-sm-8.col-sm-offset-2
|
.col-sm-8.col-sm-offset-2
|
||||||
@ -17,22 +32,12 @@ block content
|
|||||||
span.ion-android-hand
|
span.ion-android-hand
|
||||||
| Login
|
| Login
|
||||||
a.btn.btn-link(href='/forgot') Forgot your password?
|
a.btn.btn-link(href='/forgot') Forgot your password?
|
||||||
hr
|
br
|
||||||
a.btn.btn-block.btn-facebook.btn-social(href='/auth/facebook')
|
br
|
||||||
i.fa.fa-facebook
|
br
|
||||||
| Sign in with Facebook
|
br
|
||||||
a.btn.btn-block.btn-twitter.btn-social(href='/auth/twitter')
|
br
|
||||||
i.fa.fa-twitter
|
br
|
||||||
| Sign in with Twitter
|
br
|
||||||
a.btn.btn-block.btn-google-plus.btn-social(href='/auth/google')
|
br
|
||||||
i.fa.fa-google-plus
|
br
|
||||||
| 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
|
|
||||||
|
Reference in New Issue
Block a user