Merge branch '5475-email_2fa' of https://gitea.verdnatura.es/verdnatura/salix into 5475-email_2fa

This commit is contained in:
Alex Moreno 2023-06-28 07:18:10 +02:00
commit 162faf0d01
6 changed files with 14 additions and 5 deletions

View File

@ -71,8 +71,6 @@ fdescribe('VnUser Sign-in()', () => {
expect(error).toBeDefined(); expect(error).toBeDefined();
expect(error.statusCode).toBe(403); expect(error.statusCode).toBe(403);
expect(error.message).toBe('REQUIRES_2FA'); expect(error.message).toBe('REQUIRES_2FA');
await employee.updateAttribute('twoFactor', null);
}); });
}); });

View File

@ -1,6 +1,6 @@
const {models} = require('vn-loopback/server/server'); const {models} = require('vn-loopback/server/server');
fdescribe('VnUser validate-auth()', () => { describe('VnUser validate-auth()', () => {
describe('validateAuth', () => { describe('validateAuth', () => {
it('should signin if data is correct', async() => { it('should signin if data is correct', async() => {
await models.AuthCode.create({ await models.AuthCode.create({

View File

@ -22,7 +22,7 @@
autocomplete="false"> autocomplete="false">
</vn-textfield> </vn-textfield>
<vn-textfield <vn-textfield
ng-if="$ctrl.$state.params.twoFactor" ng-if="$ctrl.$state.params.twoFactor == 'true'"
label="Verification code" label="Verification code"
ng-model="$ctrl.code" ng-model="$ctrl.code"
vn-name="code" vn-name="code"

View File

@ -15,6 +15,10 @@ export default class Controller {
} }
$onInit() { $onInit() {
this.oldPassword = 'nightmare';
this.repeatPassword = 'test.1234';
this.newPassword = 'test.1234';
this.verificationCode = '1234';
if (!this.$state.params.id) if (!this.$state.params.id)
this.$state.go('login'); this.$state.go('login');

View File

@ -1,6 +1,6 @@
const {models} = require('vn-loopback/server/server'); const {models} = require('vn-loopback/server/server');
fdescribe('account changePassword()', () => { describe('account changePassword()', () => {
const ctx = {req: {accessToken: {userId: 70}}}; const ctx = {req: {accessToken: {userId: 70}}};
const unauthCtx = { const unauthCtx = {
req: { req: {

View File

@ -37,6 +37,13 @@
"principalType": "ROLE", "principalType": "ROLE",
"principalId": "$authenticated", "principalId": "$authenticated",
"permission": "ALLOW" "permission": "ALLOW"
},
{
"property": "changePassword",
"accessType": "EXECUTE",
"principalType": "ROLE",
"principalId": "$everyone",
"permission": "ALLOW"
} }
] ]
} }