Skip to content
This repository
Browse code

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 3 changed files with 6 additions and 11 deletions. Show diff stats Hide diff stats

  1. +2 2 app.js
  2. +4 7 authentication.js
  3. +0 2  models.js
4 app.js
@@ -129,11 +129,11 @@ app.post('/people/edit/:id', bacAuth.doAuth, ensureOwnsObject, function (req, re
129 129 person.bio = req.body.person.bio;
130 130 person.languages = _.map(req.body.person.language_string.split(','), function (s) { return s.replace(/\s/g, ''); });
131 131
132   - person.save(function (err) {
  132 + person.save(function (err, p) {
133 133 if (err) {
134 134 handleError(err, res);
135 135 } else {
136   - res.redirect('/people/' + req.params.id);
  136 + res.redirect('/people/' + p.url_slug);
137 137 }
138 138 });
139 139 });
11 authentication.js
@@ -97,12 +97,13 @@ passport.use(new TwitterStrategy({
97 97 done(null, person);
98 98 } else {
99 99 person = new Person();
100   - person.twitter_nick = profile.screenName;
  100 + person.name = profile.username;
  101 + person.twitter_nick = profile.username;
101 102 person.active = true;
102 103
103   - person.save(function (err, person) {
  104 + person.save(function (err, p) {
104 105 if (err) { return done(err, null); }
105   - return done(null, person);
  106 + return done(null, p);
106 107 });
107 108 }
108 109 });
@@ -115,10 +116,6 @@ passport.use(new GithubStrategy({
115 116 callbackURL: callback_url_base + '/login/github/callback'
116 117 },
117 118 function(accessToken, refreshToken, profile, done) {
118   - // console.log(accessToken);
119   - // console.log(refreshToken);
120   - // console.log(util.inspect(profile));
121   -
122 119 Person.findOne( {github_nick: profile.username }, function(err, person) {
123 120 if (err) {
124 121 return done(err, null);
2  models.js
@@ -36,13 +36,11 @@ exports.defineModels = function (
36 36 });
37 37
38 38 PersonSchema.pre('save', function (next) {
39   - console.log('PRE SAVE IS EXECUTING');
40 39 /*
41 40 * Generate an MD5 hash of the supplied email
42 41 * and save that as the gravatar string before saving
43 42 */
44 43 if (this.email) {
45   - console.log('FOUND AN EMAIL. MD5 GOOOOO');
46 44 this.gravatar = require('./MD5').toMD5(this.email);
47 45 }
48 46

0 comments on commit 9208cef

Please sign in to comment.
Something went wrong with that request. Please try again.