feat(client_web-access): add email field
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Alex Moreno 2022-06-20 07:31:10 +02:00
parent b5cea244ca
commit 8d9d64b49d
7 changed files with 39 additions and 2 deletions

View File

@ -276,6 +276,7 @@ export default {
clientWebAccess: { clientWebAccess: {
enableWebAccessCheckbox: 'vn-check[label="Enable web access"]', enableWebAccessCheckbox: 'vn-check[label="Enable web access"]',
userName: 'vn-client-web-access vn-textfield[ng-model="$ctrl.account.name"]', userName: 'vn-client-web-access vn-textfield[ng-model="$ctrl.account.name"]',
email: 'vn-client-web-access vn-textfield[ng-model="$ctrl.account.email"]',
saveButton: 'button[type=submit]' saveButton: 'button[type=submit]'
}, },
clientNotes: { clientNotes: {

View File

@ -1,3 +1,4 @@
/* eslint max-len: ["error", { "code": 150 }]*/
import selectors from '../../helpers/selectors'; import selectors from '../../helpers/selectors';
import getBrowser from '../../helpers/puppeteer'; import getBrowser from '../../helpers/puppeteer';
@ -33,6 +34,15 @@ describe('Client Edit web access path', () => {
expect(message.text).toContain('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it(`should update the email`, async() => {
await page.clearInput(selectors.clientWebAccess.email);
await page.write(selectors.clientWebAccess.email, 'hulk@marvel.com');
await page.waitToClick(selectors.clientWebAccess.saveButton);
const message = await page.waitForSnackbar();
expect(message.text).toContain('Data saved!');
});
it('should reload the section and confirm web access is now unchecked', async() => { it('should reload the section and confirm web access is now unchecked', async() => {
await page.reloadSection('client.card.webAccess'); await page.reloadSection('client.card.webAccess');
const result = await page.checkboxState(selectors.clientWebAccess.enableWebAccessCheckbox); const result = await page.checkboxState(selectors.clientWebAccess.enableWebAccessCheckbox);

View File

@ -62,7 +62,7 @@ module.exports = function(Self) {
{ {
relation: 'account', relation: 'account',
scope: { scope: {
fields: ['id', 'name', 'active'] fields: ['id', 'name', 'email', 'active']
} }
}, },
{ {

View File

@ -13,6 +13,11 @@ module.exports = Self => {
type: 'string', type: 'string',
description: 'the user name' description: 'the user name'
}, },
{
arg: 'email',
type: 'string',
description: 'the user email'
},
{ {
arg: 'active', arg: 'active',
type: 'boolean', type: 'boolean',

View File

@ -5,6 +5,11 @@
data="$ctrl.account" data="$ctrl.account"
form="form"> form="form">
</vn-watcher> </vn-watcher>
<vn-crud-model
auto-load="true"
url="UserPasswords"
data="$ctrl.passRequirements">
</vn-crud-model>
<form name="form" ng-submit="$ctrl.onSubmit()" class="vn-w-md"> <form name="form" ng-submit="$ctrl.onSubmit()" class="vn-w-md">
<vn-card class="vn-pa-lg"> <vn-card class="vn-pa-lg">
<vn-horizontal> <vn-horizontal>
@ -28,6 +33,18 @@
rule> rule>
</vn-textfield> </vn-textfield>
</vn-horizontal> </vn-horizontal>
<vn-horizontal>
<vn-textfield
vn-id="email"
disabled="watcher.orgData.active != $ctrl.account.active"
vn-focus
vn-one
label="Recovery email"
ng-model="$ctrl.account.email"
info="This email is used for user to regain access to an account you're unable to sign in to."
rule>
</vn-textfield>
</vn-horizontal>
</vn-card> </vn-card>
<vn-button-bar> <vn-button-bar>
<vn-submit <vn-submit
@ -55,6 +72,7 @@
<vn-textfield <vn-textfield
type="password" type="password"
label="New password" label="New password"
info="{{'Password requirements' | translate:$ctrl.passRequirements[0]}}"
ng-model="$ctrl.newPassword"> ng-model="$ctrl.newPassword">
</vn-textfield> </vn-textfield>
<vn-textfield <vn-textfield

View File

@ -63,6 +63,7 @@ export default class Controller extends Section {
onSubmit() { onSubmit() {
const data = { const data = {
name: this.account.name, name: this.account.name,
email: this.account.email,
active: this.account.active active: this.account.active
}; };
this.$http.patch(`Clients/${this.client.id}/updateUser`, data).then(() => { this.$http.patch(`Clients/${this.client.id}/updateUser`, data).then(() => {

View File

@ -5,3 +5,5 @@ Repeat password: Repetir contraseña
Change password: Cambiar contraseña Change password: Cambiar contraseña
Passwords don't match: Las contraseñas no coinciden Passwords don't match: Las contraseñas no coinciden
You must enter a new password: Debes introducir una nueva contraseña You must enter a new password: Debes introducir una nueva contraseña
Recovery email: Correo de recuperación
This email is used for user to regain access to an account you're unable to sign in to.: Este correo electrónico se usa para que el usuario recupere el acceso a una cuenta en la que no puede iniciar sesión.