mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-20 22:42:53 -05:00
parent
4067bfe4c1
commit
af1d2201b0
2 changed files with 7 additions and 5 deletions
|
@ -4,7 +4,6 @@ var _ = require('lodash'),
|
|||
mail = require('./mail'),
|
||||
globalUtils = require('../utils'),
|
||||
utils = require('./utils'),
|
||||
users = require('./users'),
|
||||
Promise = require('bluebird'),
|
||||
errors = require('../errors'),
|
||||
config = require('../config'),
|
||||
|
@ -42,9 +41,8 @@ authentication = {
|
|||
return Promise.reject(new errors.BadRequestError('No email provided.'));
|
||||
}
|
||||
|
||||
return users.read({context: {internal: true}, email: email, status: 'active'}).then(function () {
|
||||
return settings.read({context: {internal: true}, key: 'dbHash'});
|
||||
}).then(function (response) {
|
||||
return settings.read({context: {internal: true}, key: 'dbHash'})
|
||||
.then(function (response) {
|
||||
var dbHash = response.settings[0].value;
|
||||
return dataProvider.User.generateResetToken(email, expires, dbHash);
|
||||
}).then(function (resetToken) {
|
||||
|
|
|
@ -781,10 +781,14 @@ User = ghostBookshelf.Model.extend({
|
|||
}).then(function (email) {
|
||||
// Fetch the user by email, and hash the password at the same time.
|
||||
return Promise.join(
|
||||
self.forge({email: email.toLocaleLowerCase()}).fetch({require: true}),
|
||||
self.getByEmail(email),
|
||||
generatePasswordHash(newPassword)
|
||||
);
|
||||
}).then(function (results) {
|
||||
if (!results[0]) {
|
||||
return Promise.reject(new Error('User not found'));
|
||||
}
|
||||
|
||||
// Update the user with the new password hash
|
||||
var foundUser = results[0],
|
||||
passwordHash = results[1];
|
||||
|
|
Loading…
Add table
Reference in a new issue