refs #5753 fix(change-password)

This commit is contained in:
Alex Moreno 2023-06-15 11:49:39 +02:00
parent 3862e3084e
commit 99ad9d3afa
10 changed files with 16 additions and 19 deletions

View File

@ -14,7 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed ### Fixed
- -
## [2324.01] - 2023-06-08 ## [2324.01] - 2023-06-15
### Added ### Added
- (Tickets -> Abono) Al abonar permite crear el ticket abono con almacén o sin almmacén - (Tickets -> Abono) Al abonar permite crear el ticket abono con almacén o sin almmacén

View File

@ -8,7 +8,7 @@ Salix is also the scientific name of a beautifull tree! :)
Required applications. Required applications.
* Node.js = 14.x LTS * Node.js >= 16.x LTS
* Docker * Docker
* Git * Git

View File

@ -62,10 +62,9 @@ module.exports = Self => {
scopes: ['change-password'], scopes: ['change-password'],
userId: vnUser.id userId: vnUser.id
}); });
throw new UserError('Pass expired', 'passExpired', { const err = new UserError('Pass expired', 'passExpired');
id: vnUser.id, err.details = {token: changePasswordToken};
token: changePasswordToken.id throw err;
});
} }
try { try {

View File

@ -15,7 +15,7 @@ export default class Controller {
} }
$onInit() { $onInit() {
if (!this.$state.params || !this.$state.params.id || !this.$state.params.token) if (!this.$state.params.id)
this.$state.go('login'); this.$state.go('login');
this.$http.get('UserPasswords/findOne') this.$http.get('UserPasswords/findOne')
@ -25,7 +25,7 @@ export default class Controller {
} }
submit() { submit() {
const id = this.$state.params.id; const userId = this.$state.params.userId;
const newPassword = this.newPassword; const newPassword = this.newPassword;
const oldPassword = this.oldPassword; const oldPassword = this.oldPassword;
@ -35,12 +35,12 @@ export default class Controller {
throw new UserError(`Passwords don't match`); throw new UserError(`Passwords don't match`);
const headers = { const headers = {
Authorization: this.$state.params.token Authorization: this.$state.params.id
}; };
this.$http.post('VnUsers/change-password', this.$http.post('VnUsers/change-password',
{ {
id, id: userId,
oldPassword, oldPassword,
newPassword newPassword
}, },

View File

@ -27,10 +27,9 @@ export default class Controller {
this.loading = false; this.loading = false;
this.password = ''; this.password = '';
this.focusUser(); this.focusUser();
if (req?.data?.error?.code == 'passExpired') { const err = req.data?.error;
const [args] = req.data.error.translateArgs; if (err?.code == 'passExpired')
this.$state.go('change-password', args); this.$state.go('change-password', err.details.token);
}
throw req; throw req;
}); });

View File

@ -38,7 +38,7 @@ function config($stateProvider, $urlRouterProvider) {
}) })
.state('change-password', { .state('change-password', {
parent: 'outLayout', parent: 'outLayout',
url: '/change-password?id&token', url: '/change-password?id&userId',
description: 'Change password', description: 'Change password',
template: '<vn-change-password></vn-change-password>' template: '<vn-change-password></vn-change-password>'
}) })

View File

@ -5,8 +5,7 @@ import UserError from 'core/lib/user-error';
export default class Controller extends Section { export default class Controller extends Section {
onSynchronizeAll() { onSynchronizeAll() {
this.vnApp.showSuccess(this.$t('Synchronizing in the background')); this.vnApp.showSuccess(this.$t('Synchronizing in the background'));
this.$http.patch(`Accounts/syncAll`) this.$http.patch(`Accounts/syncAll`);
.then(() => this.vnApp.showSuccess(this.$t('Users synchronized!')));
} }
onUserSync() { onUserSync() {

View File

@ -1,6 +1,6 @@
{ {
"name": "salix-back", "name": "salix-back",
"version": "23.26.01", "version": "23.24.01",
"author": "Verdnatura Levante SL", "author": "Verdnatura Levante SL",
"description": "Salix backend", "description": "Salix backend",
"license": "GPL-3.0", "license": "GPL-3.0",