Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update UI #53

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
File renamed without changes.
Empty file added app/views/includes/footer.html
Empty file.
Empty file added app/views/includes/head.html
Empty file.
11 changes: 3 additions & 8 deletions app/views/includes/head.jade
Expand Up @@ -4,14 +4,9 @@ head
meta(name='description', content='twitter written in node js')
meta(name='author', content='Vinit Kumar')

link(href='/css/bootstrap.css', rel='stylesheet')
link(href='/css/font-awesome.min.css', rel="stylesheet")
link(href='/css/bootstrap-responsive.min.css', rel='stylesheet')
link(href='/css/pygments-manni.css', rel='stylesheet')
link(href='/css/docs.css', rel='stylesheet')
link(href='/css/style.css', rel='stylesheet')
//
HTML5 shim, for IE6-8 support of HTML5 elements
link(href='/css/bootstrap.min.css', rel='stylesheet')

//HTML5 shim, for IE6-8 support of HTML5 elements
//if lt IE 9
script(src='/js/html5shiv.js')
//
Expand Down
Empty file added app/views/includes/header.html
Empty file.
28 changes: 14 additions & 14 deletions config/config.js
Expand Up @@ -8,42 +8,42 @@ module.exports = {
name: 'Node Twitter'
},
facebook: {
clientID: "273381409494888",
clientSecret: "7752245834fc257678f9695c6684c29b",
callbackURL: "http://ntwitter.nodejitsu.com/auth/facebook/callback"
clientID: "255350354640375",
clientSecret: "0206d7cd66962dd59d90472d810c3464",
callbackURL: "http://localhost:3000/auth/facebook/callback"
},
github: {
clientID: 'c2e0f478634366e1289d',
clientSecret: '0bfde82383deeb99b28d0f6a9eac001a0deb798a',
callbackURL: 'http://ntwitter.nodejitsu.com/auth/github/callback'
callbackURL: 'http://localhost:3000/auth/github/callback'
},
twitter: {
clientID: 'J3RJBEzrLd9lVloHf6uGQ',
clientSecret: 'DwAEaZX84iFg2LYdWHLHQF9l4idAqQWPL2LTCPnEjM',
callbackURL: "http://ntwitter.nodejitsu.com//auth/twitter/callback"
callbackURL: "http://ntwitter.nodejitsu.com/auth/twitter/callback"
},
},
test: {
db: 'mongodb://root:volvo76@ds039078.mongolab.com:39078/ntwitter',
db: 'mongodb://localhost/noobjs_test21',
root: rootPath,
app: {
name: 'Nodejs Express Mongoose Demo'
},
facebook: {
clientID: "273381409494888",
clientSecret: "7752245834fc257678f9695c6684c29b",
callbackURL: "http://ntwitter.nodejitsu.com/auth/facebook/callback"
clientID: "255350354640375",
clientSecret: "0206d7cd66962dd59d90472d810c3464",
callbackURL: "http://localhost:3000/auth/facebook/callback"
},
github: {
clientID: 'c2e0f478634366e1289d',
clientSecret: '0bfde82383deeb99b28d0f6a9eac001a0deb798a',
callbackURL: 'http://ntwitter.nodejitsu.com/auth/github/callback'
callbackURL: 'http://127.0.0.1:3000/auth/github/callback'
},
twitter: {
twitter: {
clientID: 'J3RJBEzrLd9lVloHf6uGQ',
clientSecret: 'DwAEaZX84iFg2LYdWHLHQF9l4idAqQWPL2LTCPnEjM',
callbackURL: "http://ntwitter.nodejitsu.com//auth/twitter/callback"
},
callbackURL: "http://ntwitter.nodejitsu.com/auth/twitter/callback"
}
},
production: {
db: 'mongodb://root:volvo76@ds039078.mongolab.com:39078/ntwitter',
Expand All @@ -64,7 +64,7 @@ module.exports = {
twitter: {
clientID: 'J3RJBEzrLd9lVloHf6uGQ',
clientSecret: 'DwAEaZX84iFg2LYdWHLHQF9l4idAqQWPL2LTCPnEjM',
callbackURL: "http://ntwitter.nodejitsu.com//auth/twitter/callback"
callbackURL: "http://ntwitter.nodejitsu.com/auth/twitter/callback"
},
}
};
4 changes: 2 additions & 2 deletions config/config.local.js
Expand Up @@ -25,8 +25,8 @@ module.exports = {
name: 'Nodejs Express Mongoose Demo'
},
facebook: {
clientID: "476135909128021",
clientSecret: "0f6a6403b1c9cb678164400032369a16",
clientID: "255350354640375",
clientSecret: "0206d7cd66962dd59d90472d810c3464",
callbackURL: "http://localhost:3000/auth/facebook/callback"
},
github: {
Expand Down
8 changes: 7 additions & 1 deletion config/express.js
Expand Up @@ -25,8 +25,14 @@ module.exports = function (app, config, passport) {
app.use(express.logger('dev'));
}

// assign the template engine to .html files
app.engine('html', consolidate[config.templateEngine]);

// set .html as the default extension
app.set('view engine', 'html');

app.set('views', config.root+'/app/views');
app.set('view engine', 'jade');
app.set('view engine', 'swig');
app.configure(function () {
app.use(helpers(config.app.name));
app.use(express.cookieParser());
Expand Down
104 changes: 52 additions & 52 deletions config/passport.js
Expand Up @@ -71,58 +71,58 @@ module.exports = function (passport, config) {
}
));

// use github strategy
passport.use(new GitHubStrategy({
clientID: config.github.clientID,
clientSecret: config.github.clientSecret,
callbackURL: config.github.callbackURL
},
function(accessToken, refreshToken, profile, done) {
User.findOne({ 'github.id': profile.id }, function (err, user) {
if (!user) {
user = new User({
name: profile.displayName,
email: profile.emails[0].value,
username: profile.username,
provider: 'github',
github: profile._json
});
user.save(function (err) {
if (err) console.log(err);
return done(err, user);
});
} else {
return done(err, user);
}
});
}
));
// // use github strategy
// passport.use(new GitHubStrategy({
// clientID: config.github.clientID,
// clientSecret: config.github.clientSecret,
// callbackURL: config.github.callbackURL
// },
// function(accessToken, refreshToken, profile, done) {
// User.findOne({ 'github.id': profile.id }, function (err, user) {
// if (!user) {
// user = new User({
// name: profile.displayName,
// email: profile.emails[0].value,
// username: profile.username,
// provider: 'github',
// github: profile._json
// });
// user.save(function (err) {
// if (err) console.log(err);
// return done(err, user);
// });
// } else {
// return done(err, user);
// }
// });
// }
// ));

passport.use(new TwitterStrategy({
consumerKey: config.twitter.clientID,
consumerSecret: config.twitter.clientSecret,
callbackURL: config.twitter.callbackURL
},
function(token, tokenSecret, profile, done) {
User.findOne({ 'twitter.id_str': profile.id }, function (err, user) {
if (err) { return done(err) }
if (!user) {
user = new User({
name: profile.displayName,
username: profile.username,
provider: 'twitter',
twitter: profile._json
})
user.save(function (err) {
if (err) console.log(err)
return done(err, user)
})
}
else {
return done(err, user)
}
})
}
))
// passport.use(new TwitterStrategy({
// consumerKey: config.twitter.clientID,
// consumerSecret: config.twitter.clientSecret,
// callbackURL: config.twitter.callbackURL
// },
// function(token, tokenSecret, profile, done) {
// User.findOne({ 'twitter.id_str': profile.id }, function (err, user) {
// if (err) { return done(err) }
// if (!user) {
// user = new User({
// name: profile.displayName,
// username: profile.username,
// provider: 'twitter',
// twitter: profile._json
// })
// user.save(function (err) {
// if (err) console.log(err)
// return done(err, user)
// })
// }
// else {
// return done(err, user)
// }
// })
// }
// ))

};
8 changes: 4 additions & 4 deletions config/routes.js
Expand Up @@ -10,10 +10,10 @@ module.exports = function (app, passport, auth) {
app.get('/users/:userId', users.show);
app.get('/auth/facebook', passport.authenticate('facebook',{scope: ['email', 'user_about_me'], failureRedirect: '/login' }), users.signin);
app.get('/auth/facebook/callback', passport.authenticate('facebook', { failureRedirect: '/login' }), users.authCallback);
app.get('/auth/github', passport.authenticate('github', { failureRedirect: '/login' }), users.signin);
app.get('/auth/github/callback', passport.authenticate('github', { failureRedirect: '/login' }), users.authCallback);
app.get('/auth/twitter', passport.authenticate('twitter', { failureRedirect: '/login' }), users.signin);
app.get('/auth/twitter/callback', passport.authenticate('twitter', { successRedirect: '/', failureRedirect: '/login' }));
// app.get('/auth/github', passport.authenticate('github', { failureRedirect: '/login' }), users.signin);
// app.get('/auth/github/callback', passport.authenticate('github', { failureRedirect: '/login' }), users.authCallback);
// app.get('/auth/twitter', passport.authenticate('twitter', { failureRedirect: '/login' }), users.signin);
// app.get('/auth/twitter/callback', passport.authenticate('twitter', { successRedirect: '/', failureRedirect: '/login' }));


app.param('userId', users.user);
Expand Down
3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -30,7 +30,8 @@
"gzippo": "latest",
"async": "latest",
"view-helpers": "latest",
"forever": "latest"
"forever": "latest",
"swig": "~1.3.2"
},
"devDependencies": {
"supertest": "latest",
Expand Down