From 07e9d80c5766ab11018731eb1bc919385cc5dad6 Mon Sep 17 00:00:00 2001 From: Paola Date: Tue, 13 Jul 2021 15:02:00 -0600 Subject: [PATCH 01/12] Validacion Google para modificar perfil --- .../account/settings/settings.component.html | 19 +++++++++++++++---- .../account/settings/settings.component.ts | 11 ++++++++++- src/main/webapp/i18n/es/login.json | 3 ++- 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/src/main/webapp/app/account/settings/settings.component.html b/src/main/webapp/app/account/settings/settings.component.html index 68d5f1a..3e364b9 100644 --- a/src/main/webapp/app/account/settings/settings.component.html +++ b/src/main/webapp/app/account/settings/settings.component.html @@ -163,7 +163,7 @@ - + ------------------------------------------------------------------------------- --> @@ -273,6 +273,8 @@ Utilice una contraseña segura al realizar el cambio, este dato debe ser secreto ya que provee acceso a su cuenta.

+ +
@@ -297,9 +299,14 @@ data-cy="password" formControlName="password" placeholder="Su contraseña actual" + [readOnly]="isGoogle" />
{ // }); @@ -160,6 +168,7 @@ export class SettingsComponent implements OnInit { this.isSaving = false; } + //Llena el formulario para que se vea en pantalla protected updateForm(usuarioExtra: IUsuarioExtra): void { this.editForm.patchValue({ email: usuarioExtra.user?.login, diff --git a/src/main/webapp/i18n/es/login.json b/src/main/webapp/i18n/es/login.json index 4d5b925..9266406 100644 --- a/src/main/webapp/i18n/es/login.json +++ b/src/main/webapp/i18n/es/login.json @@ -9,7 +9,8 @@ }, "messages": { "error": { - "authentication": "Revise las credenciales e intente de nuevo " + "authentication": "Revise las credenciales e intente de nuevo ", + "isGoogle": "Al haber ingresado por medio de Google no cuenta con los permisos para modificar su contraseña" } }, "password": { From 48a894c455db28cd9b792c5be064c56d422dfc38 Mon Sep 17 00:00:00 2001 From: Paola Date: Tue, 13 Jul 2021 20:27:28 -0600 Subject: [PATCH 02/12] Alertas modificacion usuario --- .../account/settings/settings.component.html | 14 ++++++-- .../account/settings/settings.component.ts | 32 ++++++++++++------- .../usuario-extra/usuario-extra.model.ts | 4 +-- src/main/webapp/i18n/es/global.json | 3 +- 4 files changed, 36 insertions(+), 17 deletions(-) diff --git a/src/main/webapp/app/account/settings/settings.component.html b/src/main/webapp/app/account/settings/settings.component.html index 3e364b9..9cb0e3e 100644 --- a/src/main/webapp/app/account/settings/settings.component.html +++ b/src/main/webapp/app/account/settings/settings.component.html @@ -180,7 +180,7 @@
- +
+
+ +
@@ -221,7 +229,7 @@
- + >): void { result.pipe(finalize(() => this.onSaveFinalize())).subscribe( - () => this.onSaveSuccess(), - () => this.onSaveError() + () => (this.success = true), + response => this.processError(response) ); } + processError(response: HttpErrorResponse): void { + if (response.status === 400) { + this.error = true; + } + } protected onSaveSuccess(): void { this.previousState(); @@ -182,7 +190,7 @@ export class SettingsComponent implements OnInit { }); // Update swiper - this.profileIcon = parseInt(usuarioExtra.iconoPerfil!); + this.profileIcon = usuarioExtra.iconoPerfil!; this.profileIcons.forEach(icon => { if (parseInt(icon.name.split('C')[1]) === this.profileIcon) { icon.class = 'active'; @@ -219,7 +227,7 @@ export class SettingsComponent implements OnInit { ...new UsuarioExtra(), id: this.editForm.get(['id'])!.value, nombre: this.editForm.get(['nombre'])!.value, - iconoPerfil: this.editForm.get(['iconoPerfil'])!.value, + iconoPerfil: this.profileIcon, fechaNacimiento: this.editForm.get(['fechaNacimiento'])!.value ? dayjs(this.editForm.get(['fechaNacimiento'])!.value, DATE_TIME_FORMAT) : undefined, @@ -234,6 +242,8 @@ export class SettingsComponent implements OnInit { document.querySelectorAll('.active').forEach(e => e.classList.remove('active')); event.target.classList.add('active'); this.profileIcon = +event.target.getAttribute('id')! + 1; + + console.log(this.profileIcon); } } } diff --git a/src/main/webapp/app/entities/usuario-extra/usuario-extra.model.ts b/src/main/webapp/app/entities/usuario-extra/usuario-extra.model.ts index 5f4c94f..19bd7f3 100644 --- a/src/main/webapp/app/entities/usuario-extra/usuario-extra.model.ts +++ b/src/main/webapp/app/entities/usuario-extra/usuario-extra.model.ts @@ -8,7 +8,7 @@ import { EstadoUsuario } from 'app/entities/enumerations/estado-usuario.model'; export interface IUsuarioExtra { id?: number; nombre?: string; - iconoPerfil?: string | null; + iconoPerfil?: number | null; fechaNacimiento?: dayjs.Dayjs | null; estado?: EstadoUsuario; user?: IUser | null; @@ -21,7 +21,7 @@ export class UsuarioExtra implements IUsuarioExtra { constructor( public id?: number, public nombre?: string, - public iconoPerfil?: string | null, + public iconoPerfil?: number | null, public fechaNacimiento?: dayjs.Dayjs | null, public estado?: EstadoUsuario, public user?: IUser | null, diff --git a/src/main/webapp/i18n/es/global.json b/src/main/webapp/i18n/es/global.json index 8484710..bc24f01 100644 --- a/src/main/webapp/i18n/es/global.json +++ b/src/main/webapp/i18n/es/global.json @@ -65,7 +65,8 @@ "authenticated": { "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\")." + "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" }, "register": { "noaccount": "¿Aún no tienes una cuenta?", From ab65108475b4ebfd5ee486dbc999f26ea87c2929 Mon Sep 17 00:00:00 2001 From: Paola Date: Tue, 13 Jul 2021 21:49:46 -0600 Subject: [PATCH 03/12] Validacion fecha para modifcacion perfil --- .../webapp/app/account/settings/settings.component.html | 2 ++ src/main/webapp/app/account/settings/settings.component.ts | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/webapp/app/account/settings/settings.component.html b/src/main/webapp/app/account/settings/settings.component.html index 9cb0e3e..33bfed4 100644 --- a/src/main/webapp/app/account/settings/settings.component.html +++ b/src/main/webapp/app/account/settings/settings.component.html @@ -390,6 +390,7 @@
+
+
+
+ The password and its confirmation do not match! +
+
This field is required. + + + Your password is required to be at least 4 characters. + + + + Your password cannot be longer than 50 characters. +
@@ -353,6 +380,22 @@ > This field is required.
+ + + Your password is required to be at least 4 characters. + + + + Your password cannot be longer than 50 characters. +
@@ -384,6 +427,21 @@ > This field is required. + + Your password is required to be at least 4 characters. + + + + Your password cannot be longer than 50 characters. + diff --git a/src/main/webapp/app/account/settings/settings.component.ts b/src/main/webapp/app/account/settings/settings.component.ts index 0c5b543..82ee0f8 100644 --- a/src/main/webapp/app/account/settings/settings.component.ts +++ b/src/main/webapp/app/account/settings/settings.component.ts @@ -16,6 +16,7 @@ import { UsuarioExtraService } from 'app/entities/usuario-extra/service/usuario- import { AccountService } from 'app/core/auth/account.service'; import { LocalStorageService } from 'ngx-webstorage'; import { EMAIL_ALREADY_USED_TYPE, LOGIN_ALREADY_USED_TYPE } from '../../config/error.constants'; +import { PasswordService } from '../password/password.service'; @Component({ selector: 'jhi-settings', @@ -25,6 +26,7 @@ export class SettingsComponent implements OnInit { isSaving = false; success = false; error = false; + doNotMatch = false; usersSharedCollection: IUser[] = []; plantillasSharedCollection: IPlantilla[] = []; @@ -44,9 +46,9 @@ export class SettingsComponent implements OnInit { //form de la contraseña passwordForm = this.fb.group({ - password: [null, [Validators.required]], - passwordNew: [null, [Validators.required]], - passwordNewConfirm: [null, [Validators.required]], + password: [null, [Validators.required], Validators.minLength(8), Validators.maxLength(50)], + passwordNew: [null, [Validators.required], Validators.minLength(8), Validators.maxLength(50)], + passwordNewConfirm: [null, [Validators.required, Validators.minLength(8), Validators.maxLength(50)]], }); usuarioExtra: UsuarioExtra | null = null; @@ -89,7 +91,8 @@ export class SettingsComponent implements OnInit { protected activatedRoute: ActivatedRoute, protected fb: FormBuilder, protected accountService: AccountService, - private localStorageService: LocalStorageService + private localStorageService: LocalStorageService, + protected passwordService: PasswordService ) {} ngOnInit(): void { @@ -131,6 +134,20 @@ export class SettingsComponent implements OnInit { console.log(usuarioExtra.fechaNacimiento); this.subscribeToSaveResponse(this.usuarioExtraService.update(usuarioExtra)); + + window.location.reload(); + } + + savePassword(): void { + const password = this.passwordForm.get(['password'])!.value; + if (password !== this.passwordForm.get(['passwordNew'])!.value) { + this.doNotMatch = true; + } else { + this.passwordService.save(this.passwordForm.get(['passwordNew'])!.value, password).subscribe( + () => (this.success = true), + () => (this.error = true) + ); + } } trackUserById(index: number, item: IUser): number { @@ -237,8 +254,6 @@ export class SettingsComponent implements OnInit { }; } - protected CreateFormPassword(); - selectIcon(event: MouseEvent): void { if (event.target instanceof Element) { document.querySelectorAll('.active').forEach(e => e.classList.remove('active')); From ade37077cc8e9e88762766e6fbaa074babc4a714 Mon Sep 17 00:00:00 2001 From: Mariela Bonilla Date: Thu, 15 Jul 2021 02:29:31 -0600 Subject: [PATCH 06/12] Arreglo de estilos en las paginas MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Se modificó la página de activación de cuenta, ya estaba desactualizada se agregó un height:100% al registro para que el fondo quedará completamente coloreado y no se vieran dos colores --- .../account/activate/activate.component.html | 55 +++++++++++++++---- .../account/register/register.component.html | 2 +- src/main/webapp/i18n/es/global.json | 3 +- 3 files changed, 48 insertions(+), 12 deletions(-) diff --git a/src/main/webapp/app/account/activate/activate.component.html b/src/main/webapp/app/account/activate/activate.component.html index 46a5b40..c673ae0 100644 --- a/src/main/webapp/app/account/activate/activate.component.html +++ b/src/main/webapp/app/account/activate/activate.component.html @@ -1,16 +1,51 @@ -
-
-
-

Activation

+