agregar logica de evaluación de contraseña
This commit is contained in:
parent
2ae9407d7a
commit
44a83ba01a
|
@ -1,10 +1,13 @@
|
|||
<form class="ds-form" [formGroup]="passwordForm" name="deleteForm" (ngSubmit)="submitPassword()">
|
||||
<div *ngIf="this.isWrong">
|
||||
<p>Contraseña incorrecta</p>
|
||||
</div>
|
||||
<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">
|
||||
This survey is marked as private, please enter the password
|
||||
</p>
|
||||
<input type="password" name="passwordInput" id="passwordInput" placeholder="qwerty..." />
|
||||
<input [(ngModel)]="passwordInput" type="password" name="passwordInput" id="passwordInput" placeholder="qwerty..." />
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
|
|
|
@ -12,24 +12,25 @@ export class EncuestaPasswordDialogComponent implements OnInit {
|
|||
passwordForm = this.fb.group({
|
||||
password: [null, [Validators.required]],
|
||||
});
|
||||
isEval: boolean = false;
|
||||
encuesta?: IEncuesta;
|
||||
isWrong?: boolean;
|
||||
passwordInput?: string;
|
||||
|
||||
constructor(protected activeModal: NgbActiveModal, protected fb: FormBuilder) {}
|
||||
|
||||
ngOnInit(): void {}
|
||||
|
||||
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
|
||||
this.activeModal.close('success');
|
||||
} else {
|
||||
this.isWrong = true;
|
||||
}
|
||||
}
|
||||
|
||||
cancel(): void {
|
||||
this.activeModal.dismiss();
|
||||
this.activeModal.close('cancel');
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue