agregar inicio de validación de contraseña

This commit is contained in:
Eduardo Quiros 2021-08-03 20:36:26 -06:00
parent 82e7513a13
commit 1edefeb357
No known key found for this signature in database
GPG Key ID: B77F36C3F12720B4
3 changed files with 16 additions and 3 deletions

View File

@ -1,4 +1,4 @@
<form class="ds-form" name="deleteForm" (ngSubmit)="submitPassword()">
<form class="ds-form" [formGroup]="passwordForm" name="deleteForm" (ngSubmit)="submitPassword()">
<div class="modal-body">
<p class="ds-title--small" jhiTranslate="dataSurveyApp.encuesta.password.title">Enter password</p>
<p class="ds-subtitle" id="jhi-delete-encuesta-heading" jhiTranslate="dataSurveyApp.encuesta.password.text">
@ -17,7 +17,7 @@
data-cy="submit"
type="submit"
class="ds-btn ds-btn--primary"
disabled="passwordForm.get('password')!.invalid"
[disabled]="passwordForm.get('password')!.invalid"
>
<span jhiTranslate="entity.action.submit">Submit</span>
</button>

View File

@ -1,6 +1,7 @@
import { Component, OnInit } from '@angular/core';
import { FormBuilder, Validators } from '@angular/forms';
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
import { IEncuesta } from '../encuesta.model';
@Component({
selector: 'jhi-encuesta-password-dialog',
@ -11,12 +12,22 @@ export class EncuestaPasswordDialogComponent implements OnInit {
passwordForm = this.fb.group({
password: [null, [Validators.required]],
});
isEval: boolean = false;
encuesta?: IEncuesta;
constructor(protected activeModal: NgbActiveModal, protected fb: FormBuilder) {}
ngOnInit(): void {}
submitPassword() {}
submitPassword() {
this.isEval = true;
const password = this.passwordForm.get(['password'])!.value;
if (this.passwordForm.valid && password === this.encuesta!.contrasenna) {
this.isEval = false;
//navegar a la vara
}
}
cancel(): void {
this.activeModal.dismiss();

View File

@ -115,6 +115,8 @@ export class PaginaPrincipalComponent implements OnInit {
completeEncuesta(encuesta: IEncuesta): void {
if (encuesta.acceso === AccesoEncuesta.PRIVATE) {
this.confirmPassword(encuesta);
} else {
//navigate to form
}
}