From 167ff39036091380da9263e4986a4b160a7fcdd8 Mon Sep 17 00:00:00 2001 From: Paola Date: Thu, 15 Jul 2021 15:08:53 -0600 Subject: [PATCH] arreglo input password perfil --- .../account/settings/settings.component.html | 53 ++++++++++++------- .../account/settings/settings.component.ts | 14 ++--- src/main/webapp/i18n/es/global.json | 3 +- 3 files changed, 43 insertions(+), 27 deletions(-) diff --git a/src/main/webapp/app/account/settings/settings.component.html b/src/main/webapp/app/account/settings/settings.component.html index b60c1d9..d12e710 100644 --- a/src/main/webapp/app/account/settings/settings.component.html +++ b/src/main/webapp/app/account/settings/settings.component.html @@ -190,15 +190,21 @@ (ngSubmit)="save()" [formGroup]="editForm" > -
- -
+
+ + +
@@ -296,22 +302,29 @@ (ngSubmit)="savePassword()" [formGroup]="passwordForm" > - -
-
+
+ + + +
The password and its confirmation do not match!
Save diff --git a/src/main/webapp/app/account/settings/settings.component.ts b/src/main/webapp/app/account/settings/settings.component.ts index 82ee0f8..fc97e7c 100644 --- a/src/main/webapp/app/account/settings/settings.component.ts +++ b/src/main/webapp/app/account/settings/settings.component.ts @@ -25,7 +25,9 @@ import { PasswordService } from '../password/password.service'; export class SettingsComponent implements OnInit { isSaving = false; success = false; + successPassword = false; error = false; + errorPassword = false; doNotMatch = false; usersSharedCollection: IUser[] = []; plantillasSharedCollection: IPlantilla[] = []; @@ -135,17 +137,17 @@ export class SettingsComponent implements OnInit { this.subscribeToSaveResponse(this.usuarioExtraService.update(usuarioExtra)); - window.location.reload(); + //reload } savePassword(): void { - const password = this.passwordForm.get(['password'])!.value; - if (password !== this.passwordForm.get(['passwordNew'])!.value) { + const passwordNew = this.passwordForm.get(['passwordNew'])!.value; + if (passwordNew !== this.passwordForm.get(['passwordNewConfirm'])!.value) { this.doNotMatch = true; } else { - this.passwordService.save(this.passwordForm.get(['passwordNew'])!.value, password).subscribe( - () => (this.success = true), - () => (this.error = true) + this.passwordService.save(this.passwordForm.get(['passwordNew'])!.value, this.passwordForm.get(['password'])!.value).subscribe( + () => (this.successPassword = true), + () => (this.errorPassword = true) ); } } diff --git a/src/main/webapp/i18n/es/global.json b/src/main/webapp/i18n/es/global.json index bcceeb3..787970d 100644 --- a/src/main/webapp/i18n/es/global.json +++ b/src/main/webapp/i18n/es/global.json @@ -66,7 +66,8 @@ "prefix": "Si desea ", "link": "iniciar sesión", "suffix": ", puede intentar con las cuentas predeterminadas:
- Administrador (usuario=\"admin\" y contraseña=\"admin\")
- Usuario (usuario=\"user\" y contraseña=\"user\").", - "updateForm": "Ocurrió un error al actualizar su información, favor revisar los campos e intentar de nuevo" + "updateForm": "Ocurrió un error al actualizar su información, favor revisar los campos e intentar de nuevo", + "passwordForm": "Ocurrió un error al actualizar su contraseña, favor revisar los campos e intentar de nuevo" }, "register": { "noaccount": "¿Aún no tienes una cuenta?",