mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-27 22:49:56 -05:00
Merge pull request #4367 from jaswilli/issue-4277
Timeout after two seconds on gravatar lookup.
This commit is contained in:
commit
055d3a7b75
2 changed files with 9 additions and 7 deletions
|
@ -3,9 +3,9 @@ var _ = require('lodash'),
|
||||||
errors = require('../errors'),
|
errors = require('../errors'),
|
||||||
bcrypt = require('bcryptjs'),
|
bcrypt = require('bcryptjs'),
|
||||||
ghostBookshelf = require('./base'),
|
ghostBookshelf = require('./base'),
|
||||||
http = require('http'),
|
|
||||||
crypto = require('crypto'),
|
crypto = require('crypto'),
|
||||||
validator = require('validator'),
|
validator = require('validator'),
|
||||||
|
request = require('request'),
|
||||||
validation = require('../data/validation'),
|
validation = require('../data/validation'),
|
||||||
config = require('../config'),
|
config = require('../config'),
|
||||||
|
|
||||||
|
@ -845,14 +845,16 @@ User = ghostBookshelf.Model.extend({
|
||||||
resolve(userData);
|
resolve(userData);
|
||||||
}
|
}
|
||||||
|
|
||||||
http.get('http:' + gravatarUrl, function (res) {
|
request({url: gravatarUrl, timeout: 2000}, function (err, response) {
|
||||||
if (res.statusCode !== 404) {
|
if (err) {
|
||||||
|
// just resolve with no image url
|
||||||
|
resolve(userData);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (response.statusCode !== 404) {
|
||||||
userData.image = gravatarUrl;
|
userData.image = gravatarUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
resolve(userData);
|
|
||||||
}).on('error', function () {
|
|
||||||
// Error making request just continue.
|
|
||||||
resolve(userData);
|
resolve(userData);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -56,6 +56,7 @@
|
||||||
"passport": "0.2.0",
|
"passport": "0.2.0",
|
||||||
"passport-http-bearer": "1.0.1",
|
"passport-http-bearer": "1.0.1",
|
||||||
"passport-oauth2-client-password": "0.1.1",
|
"passport-oauth2-client-password": "0.1.1",
|
||||||
|
"request": "2.47.0",
|
||||||
"rss": "1.0.0",
|
"rss": "1.0.0",
|
||||||
"semver": "2.2.1",
|
"semver": "2.2.1",
|
||||||
"showdown": "https://github.com/ErisDS/showdown/archive/v0.3.2-ghost.tar.gz",
|
"showdown": "https://github.com/ErisDS/showdown/archive/v0.3.2-ghost.tar.gz",
|
||||||
|
@ -94,7 +95,6 @@
|
||||||
"matchdep": "~0.3.0",
|
"matchdep": "~0.3.0",
|
||||||
"mocha": "~1.21.4",
|
"mocha": "~1.21.4",
|
||||||
"nock": "0.47.0",
|
"nock": "0.47.0",
|
||||||
"request": "~2.42.0",
|
|
||||||
"require-dir": "~0.1.0",
|
"require-dir": "~0.1.0",
|
||||||
"rewire": "~2.1.0",
|
"rewire": "~2.1.0",
|
||||||
"should": "~4.0.4",
|
"should": "~4.0.4",
|
||||||
|
|
Loading…
Add table
Reference in a new issue