Validacion Google para modificar perfil

This commit is contained in:
Paola 2021-07-13 15:02:00 -06:00
parent df560f0b88
commit 07e9d80c57
3 changed files with 27 additions and 6 deletions

View File

@ -163,7 +163,7 @@
</form>
</div>
</div>
</div>
</div>
-------------------------------------------------------------------------------
-->
@ -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.
</p>
</div>
<div class="alert alert-danger" *ngIf="isGoogle" jhiTranslate="login.messages.error.isGoogle" data-cy="loginError"></div>
</div>
</div>
@ -297,9 +299,14 @@
data-cy="password"
formControlName="password"
placeholder="Su contraseña actual"
[readOnly]="isGoogle"
/>
<div
*ngIf="passwordForm.get('password')!.invalid && (passwordForm.get('password')!.dirty || passwordForm.get('password')!.touched)"
*ngIf="
passwordForm.get('password')!.invalid &&
(passwordForm.get('password')!.dirty || passwordForm.get('password')!.touched) &&
!isGoogle
"
>
<small
class="form-text text-danger"
@ -322,11 +329,13 @@
data-cy="passwordNew"
formControlName="passwordNew"
placeholder="Contraseña nueva"
[readOnly]="isGoogle"
/>
<div
*ngIf="
passwordForm.get('passwordNew')!.invalid &&
(passwordForm.get('passwordNew')!.dirty || passwordForm.get('passwordNew')!.touched)
(passwordForm.get('passwordNew')!.dirty || passwordForm.get('passwordNew')!.touched) &&
!isGoogle
"
>
<small
@ -351,11 +360,13 @@
data-cy="passwordNewConfirm"
formControlName="passwordNewConfirm"
placeholder="Contraseña nueva"
[readOnly]="isGoogle"
/>
<div
*ngIf="
passwordForm.get('passwordNewConfirm')!.invalid &&
(passwordForm.get('passwordNewConfirm')!.dirty || passwordForm.get('passwordNewConfirm')!.touched)
(passwordForm.get('passwordNewConfirm')!.dirty || passwordForm.get('passwordNewConfirm')!.touched) &&
!isGoogle
"
>
<small

View File

@ -14,6 +14,7 @@ import { PlantillaService } from 'app/entities/plantilla/service/plantilla.servi
import { IUsuarioExtra, UsuarioExtra } from 'app/entities/usuario-extra/usuario-extra.model';
import { UsuarioExtraService } from 'app/entities/usuario-extra/service/usuario-extra.service';
import { AccountService } from 'app/core/auth/account.service';
import { LocalStorageService } from 'ngx-webstorage';
@Component({
selector: 'jhi-settings',
@ -25,6 +26,9 @@ export class SettingsComponent implements OnInit {
usersSharedCollection: IUser[] = [];
plantillasSharedCollection: IPlantilla[] = [];
isGoogle = this.localStorageService.retrieve('IsGoogle');
//Form info del usuario
editForm = this.fb.group({
email: [null, [Validators.required]],
id: [],
@ -36,6 +40,7 @@ export class SettingsComponent implements OnInit {
plantillas: [],
});
//form de la contraseña
passwordForm = this.fb.group({
password: [null, [Validators.required]],
passwordNew: [null, [Validators.required]],
@ -81,7 +86,8 @@ export class SettingsComponent implements OnInit {
protected plantillaService: PlantillaService,
protected activatedRoute: ActivatedRoute,
protected fb: FormBuilder,
protected accountService: AccountService
protected accountService: AccountService,
private localStorageService: LocalStorageService
) {}
ngOnInit(): void {
@ -103,6 +109,8 @@ export class SettingsComponent implements OnInit {
}
});
console.log(this.isGoogle);
// this.activatedRoute.data.subscribe(({ usuarioExtra }) => {
// });
@ -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,

View File

@ -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": {