Permalink
Browse files

add google attribute to user schema and update google auth #30

  • Loading branch information...
madhums committed Dec 30, 2012
1 parent 8906576 commit 91cb95763bad409c25921a5a55a46319fcd29bae
Showing with 15 additions and 6 deletions.
  1. +1 −0 app/models/user.js
  2. +14 −6 config/passport.js
View
@@ -16,6 +16,7 @@ var UserSchema = new Schema({
, facebook: {}
, twitter: {}
, github: {}
+ , google: {}
})
// virtual attributes
View
@@ -57,7 +57,7 @@ module.exports = function (passport, config) {
, provider: 'twitter'
, twitter: profile._json
})
- user.save(function (err, user) {
+ user.save(function (err) {
if (err) console.log(err)
return done(err, user)
})
@@ -86,7 +86,7 @@ module.exports = function (passport, config) {
, provider: 'facebook'
, facebook: profile._json
})
- user.save(function (err, user) {
+ user.save(function (err) {
if (err) console.log(err)
return done(err, user)
})
@@ -114,9 +114,13 @@ module.exports = function (passport, config) {
, provider: 'github'
, github: profile._json
})
- user.save()
+ user.save(function (err) {
+ if (err) console.log(err)
+ return done(err, user)
+ })
+ } else {
+ return done(err, user)
}
- return done(err, user)
})
}
))
@@ -137,9 +141,13 @@ module.exports = function (passport, config) {
, provider: 'google'
, google: profile._json
})
- user.save()
+ user.save(function (err) {
+ if (err) console.log(err)
+ return done(err, user)
+ })
+ } else {
+ return done(err, user)
}
- return done(err, user)
})
}
));

0 comments on commit 91cb957

Please sign in to comment.