Updated changePassword()
gitea/salix/pipeline/head This commit is unstable
Details
gitea/salix/pipeline/head This commit is unstable
Details
This commit is contained in:
parent
75da4cfc3f
commit
649be482b5
|
@ -41,7 +41,7 @@ pipeline {
|
|||
}
|
||||
steps {
|
||||
nodejs('node-v14') {
|
||||
sh 'npm install --no-audit'
|
||||
sh 'npm install --no-audit --prefer-offline'
|
||||
sh 'gulp install --ci'
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,6 +29,6 @@ module.exports = Self => {
|
|||
Self.changePassword = async function(id, oldPassword, newPassword) {
|
||||
await Self.rawSql(`CALL account.user_changePassword(?, ?, ?)`,
|
||||
[id, oldPassword, newPassword]);
|
||||
// await Self.app.models.UserAccount.syncById(id, newPassword);
|
||||
await Self.app.models.UserAccount.syncById(id, newPassword);
|
||||
};
|
||||
};
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
const app = require('vn-loopback/server/server');
|
||||
const {models} = require('vn-loopback/server/server');
|
||||
|
||||
fdescribe('account changePassword()', () => {
|
||||
it('should throw an error when old password is wrong', async() => {
|
||||
let req = app.models.Account.changePassword(null, 1, 'wrongOldPass', 'newPass');
|
||||
const response = models.Account.changePassword(1, 'wrongPassword', 'nightmare.9999');
|
||||
|
||||
await expectAsync(req).toBeRejected();
|
||||
const error = new Error('ER_SIGNAL_EXCEPTION: Invalid password');
|
||||
await expectAsync(response).toBeRejectedWith(error);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue