Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Twitter doesn't send a name on user info. Sets name to username. Fixes

  • Loading branch information...
commit 9208cef085167544b2bd955971ea40884acf34a8 1 parent eeb8c72
David Pierce TheDahv authored
Showing with 6 additions and 11 deletions.
  1. +2 −2 app.js
  2. +4 −7 authentication.js
  3. +0 −2  models.js
4 app.js
View
@@ -129,11 +129,11 @@ app.post('/people/edit/:id', bacAuth.doAuth, ensureOwnsObject, function (req, re
person.bio = req.body.person.bio;
person.languages = _.map(req.body.person.language_string.split(','), function (s) { return s.replace(/\s/g, ''); });
- person.save(function (err) {
+ person.save(function (err, p) {
if (err) {
handleError(err, res);
} else {
- res.redirect('/people/' + req.params.id);
+ res.redirect('/people/' + p.url_slug);
}
});
});
11 authentication.js
View
@@ -97,12 +97,13 @@ passport.use(new TwitterStrategy({
done(null, person);
} else {
person = new Person();
- person.twitter_nick = profile.screenName;
+ person.name = profile.username;
+ person.twitter_nick = profile.username;
person.active = true;
- person.save(function (err, person) {
+ person.save(function (err, p) {
if (err) { return done(err, null); }
- return done(null, person);
+ return done(null, p);
});
}
});
@@ -115,10 +116,6 @@ passport.use(new GithubStrategy({
callbackURL: callback_url_base + '/login/github/callback'
},
function(accessToken, refreshToken, profile, done) {
- // console.log(accessToken);
- // console.log(refreshToken);
- // console.log(util.inspect(profile));
-
Person.findOne( {github_nick: profile.username }, function(err, person) {
if (err) {
return done(err, null);
2  models.js
View
@@ -36,13 +36,11 @@ exports.defineModels = function (
});
PersonSchema.pre('save', function (next) {
- console.log('PRE SAVE IS EXECUTING');
/*
* Generate an MD5 hash of the supplied email
* and save that as the gravatar string before saving
*/
if (this.email) {
- console.log('FOUND AN EMAIL. MD5 GOOOOO');
this.gravatar = require('./MD5').toMD5(this.email);
}
Please sign in to comment.
Something went wrong with that request. Please try again.