2
1
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2023-12-13 21:00:40 +01:00

🐛 fix changePassword bug (#7590)

no issue
- comparison for isLoggedInUser did not work when userId was a string
- parsing of int was missing
This commit is contained in:
Katharina Irrgang 2016-10-21 11:19:09 +02:00 committed by Hannah Wolfe
parent 8bcd000829
commit 02a1f08ba3
2 changed files with 15 additions and 1 deletions

View file

@ -683,7 +683,7 @@ User = ghostBookshelf.Model.extend({
ne2Password = object.ne2Password,
userId = parseInt(object.user_id),
oldPassword = object.oldPassword,
isLoggedInUser = object.user_id === options.context.user,
isLoggedInUser = userId === options.context.user,
user;
// If the two passwords do not match

View file

@ -560,6 +560,20 @@ describe('User Model', function run() {
done();
});
});
it('wrong old password', function (done) {
UserModel.changePassword({
newPassword: '12345678',
ne2Password: '12345678',
oldPassword: '123456789',
user_id: '1'
}, testUtils.context.owner).then(function () {
done(new Error('expected error!'));
}).catch(function (err) {
(err instanceof errors.ValidationError).should.eql(true);
done();
});
});
});
describe('success', function () {