refs #5475 feat(account_changePassword): accessScope
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Alex Moreno 2023-06-16 14:31:14 +02:00
parent dd157d59d9
commit ee1b901dea
3 changed files with 6 additions and 4 deletions

View File

@ -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;
}
};

View File

@ -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

View File

@ -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',