agregar inicio de validación de contraseña
This commit is contained in:
parent
82e7513a13
commit
1edefeb357
|
@ -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">
|
<div class="modal-body">
|
||||||
<p class="ds-title--small" jhiTranslate="dataSurveyApp.encuesta.password.title">Enter password</p>
|
<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">
|
<p class="ds-subtitle" id="jhi-delete-encuesta-heading" jhiTranslate="dataSurveyApp.encuesta.password.text">
|
||||||
|
@ -17,7 +17,7 @@
|
||||||
data-cy="submit"
|
data-cy="submit"
|
||||||
type="submit"
|
type="submit"
|
||||||
class="ds-btn ds-btn--primary"
|
class="ds-btn ds-btn--primary"
|
||||||
disabled="passwordForm.get('password')!.invalid"
|
[disabled]="passwordForm.get('password')!.invalid"
|
||||||
>
|
>
|
||||||
<span jhiTranslate="entity.action.submit">Submit</span>
|
<span jhiTranslate="entity.action.submit">Submit</span>
|
||||||
</button>
|
</button>
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { FormBuilder, Validators } from '@angular/forms';
|
import { FormBuilder, Validators } from '@angular/forms';
|
||||||
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
|
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
|
||||||
|
import { IEncuesta } from '../encuesta.model';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'jhi-encuesta-password-dialog',
|
selector: 'jhi-encuesta-password-dialog',
|
||||||
|
@ -11,12 +12,22 @@ export class EncuestaPasswordDialogComponent implements OnInit {
|
||||||
passwordForm = this.fb.group({
|
passwordForm = this.fb.group({
|
||||||
password: [null, [Validators.required]],
|
password: [null, [Validators.required]],
|
||||||
});
|
});
|
||||||
|
isEval: boolean = false;
|
||||||
|
encuesta?: IEncuesta;
|
||||||
|
|
||||||
constructor(protected activeModal: NgbActiveModal, protected fb: FormBuilder) {}
|
constructor(protected activeModal: NgbActiveModal, protected fb: FormBuilder) {}
|
||||||
|
|
||||||
ngOnInit(): void {}
|
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 {
|
cancel(): void {
|
||||||
this.activeModal.dismiss();
|
this.activeModal.dismiss();
|
||||||
|
|
|
@ -115,6 +115,8 @@ export class PaginaPrincipalComponent implements OnInit {
|
||||||
completeEncuesta(encuesta: IEncuesta): void {
|
completeEncuesta(encuesta: IEncuesta): void {
|
||||||
if (encuesta.acceso === AccesoEncuesta.PRIVATE) {
|
if (encuesta.acceso === AccesoEncuesta.PRIVATE) {
|
||||||
this.confirmPassword(encuesta);
|
this.confirmPassword(encuesta);
|
||||||
|
} else {
|
||||||
|
//navigate to form
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue