Updated changePassword()
gitea/salix/pipeline/head This commit is unstable Details

This commit is contained in:
Joan Sanchez 2022-05-13 10:52:05 +02:00
parent 75da4cfc3f
commit 649be482b5
3 changed files with 6 additions and 5 deletions

2
Jenkinsfile vendored
View File

@ -41,7 +41,7 @@ pipeline {
} }
steps { steps {
nodejs('node-v14') { nodejs('node-v14') {
sh 'npm install --no-audit' sh 'npm install --no-audit --prefer-offline'
sh 'gulp install --ci' sh 'gulp install --ci'
} }
} }

View File

@ -29,6 +29,6 @@ module.exports = Self => {
Self.changePassword = async function(id, oldPassword, newPassword) { Self.changePassword = async function(id, oldPassword, newPassword) {
await Self.rawSql(`CALL account.user_changePassword(?, ?, ?)`, await Self.rawSql(`CALL account.user_changePassword(?, ?, ?)`,
[id, oldPassword, newPassword]); [id, oldPassword, newPassword]);
// await Self.app.models.UserAccount.syncById(id, newPassword); await Self.app.models.UserAccount.syncById(id, newPassword);
}; };
}; };

View File

@ -1,9 +1,10 @@
const app = require('vn-loopback/server/server'); const {models} = require('vn-loopback/server/server');
fdescribe('account changePassword()', () => { fdescribe('account changePassword()', () => {
it('should throw an error when old password is wrong', async() => { 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);
}); });
}); });