0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-03-11 02:12:21 -05:00

Merge pull request #4320 from felixrieseberg/iss4235

Work with case-sensitive email addresses
This commit is contained in:
Jason Williams 2014-11-12 19:35:38 -06:00
commit a2e670cb0b
2 changed files with 7 additions and 5 deletions

View file

@ -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) {

View file

@ -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];