diff --git a/back/methods/vn-user/sign-in.js b/back/methods/vn-user/sign-in.js index 9963719c3..f27d40e0a 100644 --- a/back/methods/vn-user/sign-in.js +++ b/back/methods/vn-user/sign-in.js @@ -61,11 +61,12 @@ module.exports = Self => { if (vnUser.passExpired && vnUser.passExpired.getTime() <= today.getTime()) { const $ = Self.app.models; const changePasswordToken = await $.AccessToken.create({ - scopes: ['change-password'], + scopes: ['changePassword'], userId: vnUser.id }); const err = new UserError('Pass expired', 'passExpired'); - err.details = {token: changePasswordToken, twoFactor: vnUser.twoFactor ? true : false}; + changePasswordToken.twoFactor = vnUser.twoFactor ? true : false; + err.details = {token: changePasswordToken}; throw err; } }; diff --git a/front/salix/components/change-password/index.js b/front/salix/components/change-password/index.js index 3c300ba4b..81a44d9d5 100644 --- a/front/salix/components/change-password/index.js +++ b/front/salix/components/change-password/index.js @@ -19,6 +19,7 @@ export default class Controller { this.repeatPassword = 'test.1234'; this.newPassword = 'test.1234'; this.verificationCode = '1234'; + console.log(this.$state.params); if (!this.$state.params.id) this.$state.go('login'); @@ -46,7 +47,7 @@ export default class Controller { Authorization: this.$state.params.id }; console.log({ - id, + id: userId, oldPassword, newPassword, verificationCode diff --git a/modules/account/back/methods/account/change-password.js b/modules/account/back/methods/account/change-password.js index 794195947..9fbb5dd17 100644 --- a/modules/account/back/methods/account/change-password.js +++ b/modules/account/back/methods/account/change-password.js @@ -3,7 +3,7 @@ module.exports = Self => { Self.remoteMethodCtx('changePassword', { description: 'Changes the user password', accessType: 'WRITE', - accessScopes: 'change-password', + accessScopes: ['changePassword'], accepts: [ { arg: 'oldPassword',