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> </form>
</div> </div>
</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. Utilice una contraseña segura al realizar el cambio, este dato debe ser secreto ya que provee acceso a su cuenta.
</p> </p>
</div> </div>
<div class="alert alert-danger" *ngIf="isGoogle" jhiTranslate="login.messages.error.isGoogle" data-cy="loginError"></div>
</div> </div>
</div> </div>
@ -297,9 +299,14 @@
data-cy="password" data-cy="password"
formControlName="password" formControlName="password"
placeholder="Su contraseña actual" placeholder="Su contraseña actual"
[readOnly]="isGoogle"
/> />
<div <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 <small
class="form-text text-danger" class="form-text text-danger"
@ -322,11 +329,13 @@
data-cy="passwordNew" data-cy="passwordNew"
formControlName="passwordNew" formControlName="passwordNew"
placeholder="Contraseña nueva" placeholder="Contraseña nueva"
[readOnly]="isGoogle"
/> />
<div <div
*ngIf=" *ngIf="
passwordForm.get('passwordNew')!.invalid && passwordForm.get('passwordNew')!.invalid &&
(passwordForm.get('passwordNew')!.dirty || passwordForm.get('passwordNew')!.touched) (passwordForm.get('passwordNew')!.dirty || passwordForm.get('passwordNew')!.touched) &&
!isGoogle
" "
> >
<small <small
@ -351,11 +360,13 @@
data-cy="passwordNewConfirm" data-cy="passwordNewConfirm"
formControlName="passwordNewConfirm" formControlName="passwordNewConfirm"
placeholder="Contraseña nueva" placeholder="Contraseña nueva"
[readOnly]="isGoogle"
/> />
<div <div
*ngIf=" *ngIf="
passwordForm.get('passwordNewConfirm')!.invalid && passwordForm.get('passwordNewConfirm')!.invalid &&
(passwordForm.get('passwordNewConfirm')!.dirty || passwordForm.get('passwordNewConfirm')!.touched) (passwordForm.get('passwordNewConfirm')!.dirty || passwordForm.get('passwordNewConfirm')!.touched) &&
!isGoogle
" "
> >
<small <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 { IUsuarioExtra, UsuarioExtra } from 'app/entities/usuario-extra/usuario-extra.model';
import { UsuarioExtraService } from 'app/entities/usuario-extra/service/usuario-extra.service'; import { UsuarioExtraService } from 'app/entities/usuario-extra/service/usuario-extra.service';
import { AccountService } from 'app/core/auth/account.service'; import { AccountService } from 'app/core/auth/account.service';
import { LocalStorageService } from 'ngx-webstorage';
@Component({ @Component({
selector: 'jhi-settings', selector: 'jhi-settings',
@ -25,6 +26,9 @@ export class SettingsComponent implements OnInit {
usersSharedCollection: IUser[] = []; usersSharedCollection: IUser[] = [];
plantillasSharedCollection: IPlantilla[] = []; plantillasSharedCollection: IPlantilla[] = [];
isGoogle = this.localStorageService.retrieve('IsGoogle');
//Form info del usuario
editForm = this.fb.group({ editForm = this.fb.group({
email: [null, [Validators.required]], email: [null, [Validators.required]],
id: [], id: [],
@ -36,6 +40,7 @@ export class SettingsComponent implements OnInit {
plantillas: [], plantillas: [],
}); });
//form de la contraseña
passwordForm = this.fb.group({ passwordForm = this.fb.group({
password: [null, [Validators.required]], password: [null, [Validators.required]],
passwordNew: [null, [Validators.required]], passwordNew: [null, [Validators.required]],
@ -81,7 +86,8 @@ export class SettingsComponent implements OnInit {
protected plantillaService: PlantillaService, protected plantillaService: PlantillaService,
protected activatedRoute: ActivatedRoute, protected activatedRoute: ActivatedRoute,
protected fb: FormBuilder, protected fb: FormBuilder,
protected accountService: AccountService protected accountService: AccountService,
private localStorageService: LocalStorageService
) {} ) {}
ngOnInit(): void { ngOnInit(): void {
@ -103,6 +109,8 @@ export class SettingsComponent implements OnInit {
} }
}); });
console.log(this.isGoogle);
// this.activatedRoute.data.subscribe(({ usuarioExtra }) => { // this.activatedRoute.data.subscribe(({ usuarioExtra }) => {
// }); // });
@ -160,6 +168,7 @@ export class SettingsComponent implements OnInit {
this.isSaving = false; this.isSaving = false;
} }
//Llena el formulario para que se vea en pantalla
protected updateForm(usuarioExtra: IUsuarioExtra): void { protected updateForm(usuarioExtra: IUsuarioExtra): void {
this.editForm.patchValue({ this.editForm.patchValue({
email: usuarioExtra.user?.login, email: usuarioExtra.user?.login,

View File

@ -9,7 +9,8 @@
}, },
"messages": { "messages": {
"error": { "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": { "password": {