refs #5475 feat(account_changePassword): accessScope
gitea/salix/pipeline/head There was a failure building this commit
Details
gitea/salix/pipeline/head There was a failure building this commit
Details
This commit is contained in:
parent
dd157d59d9
commit
ee1b901dea
|
@ -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;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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',
|
||||
|
|
Loading…
Reference in New Issue