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()) {
|
if (vnUser.passExpired && vnUser.passExpired.getTime() <= today.getTime()) {
|
||||||
const $ = Self.app.models;
|
const $ = Self.app.models;
|
||||||
const changePasswordToken = await $.AccessToken.create({
|
const changePasswordToken = await $.AccessToken.create({
|
||||||
scopes: ['change-password'],
|
scopes: ['changePassword'],
|
||||||
userId: vnUser.id
|
userId: vnUser.id
|
||||||
});
|
});
|
||||||
const err = new UserError('Pass expired', 'passExpired');
|
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;
|
throw err;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -19,6 +19,7 @@ export default class Controller {
|
||||||
this.repeatPassword = 'test.1234';
|
this.repeatPassword = 'test.1234';
|
||||||
this.newPassword = 'test.1234';
|
this.newPassword = 'test.1234';
|
||||||
this.verificationCode = '1234';
|
this.verificationCode = '1234';
|
||||||
|
console.log(this.$state.params);
|
||||||
if (!this.$state.params.id)
|
if (!this.$state.params.id)
|
||||||
this.$state.go('login');
|
this.$state.go('login');
|
||||||
|
|
||||||
|
@ -46,7 +47,7 @@ export default class Controller {
|
||||||
Authorization: this.$state.params.id
|
Authorization: this.$state.params.id
|
||||||
};
|
};
|
||||||
console.log({
|
console.log({
|
||||||
id,
|
id: userId,
|
||||||
oldPassword,
|
oldPassword,
|
||||||
newPassword,
|
newPassword,
|
||||||
verificationCode
|
verificationCode
|
||||||
|
|
|
@ -3,7 +3,7 @@ module.exports = Self => {
|
||||||
Self.remoteMethodCtx('changePassword', {
|
Self.remoteMethodCtx('changePassword', {
|
||||||
description: 'Changes the user password',
|
description: 'Changes the user password',
|
||||||
accessType: 'WRITE',
|
accessType: 'WRITE',
|
||||||
accessScopes: 'change-password',
|
accessScopes: ['changePassword'],
|
||||||
accepts: [
|
accepts: [
|
||||||
{
|
{
|
||||||
arg: 'oldPassword',
|
arg: 'oldPassword',
|
||||||
|
|
Loading…
Reference in New Issue