diff --git a/src/main/webapp/app/entities/encuesta/complete/complete.component.ts b/src/main/webapp/app/entities/encuesta/complete/complete.component.ts index 1f188b7..07c6137 100644 --- a/src/main/webapp/app/entities/encuesta/complete/complete.component.ts +++ b/src/main/webapp/app/entities/encuesta/complete/complete.component.ts @@ -75,12 +75,7 @@ export class EncuestaCompleteComponent implements OnInit { this.cantidadCalificaciones = parseInt(this.encuesta!.calificacion!.toString().split('.')[1]); this.sumCalificacion = this.avgCalificacion * this.cantidadCalificaciones; } - this.isLocked = this.verifyPassword(); - if (this.isLocked) { - this.previousState(); - } else { - this.loadAll(); - } + this.verifyPassword(); }); for (let pregunta of this.ePreguntas!) { if (pregunta.tipo && pregunta.tipo === PreguntaCerradaTipo.SINGLE) { @@ -89,17 +84,22 @@ export class EncuestaCompleteComponent implements OnInit { } } - verifyPassword(): boolean { + verifyPassword(): void { if (this.encuesta!.acceso === AccesoEncuesta.PUBLIC) { - return false; + this.loadAll(); + this.isLocked = false; } else { const modalRef = this.modalService.open(EncuestaPasswordDialogComponent, { size: 'lg', backdrop: 'static' }); modalRef.componentInstance.encuesta = this.encuesta; modalRef.closed.subscribe(reason => { - return reason === 'success'; + this.isLocked = reason != 'success'; + if (this.isLocked) { + this.previousState(); + } else { + this.loadAll(); + } }); } - return true; } ngAfterViewChecked(): void { @@ -194,7 +194,6 @@ export class EncuestaCompleteComponent implements OnInit { this.getOpenQuestionAnswers(); this.registerOpenQuestionAnswers(); this.updateEncuestaRating(); - this.previousState(); } diff --git a/src/main/webapp/app/entities/encuesta/encuesta-password-dialog/encuesta-password-dialog.component.html b/src/main/webapp/app/entities/encuesta/encuesta-password-dialog/encuesta-password-dialog.component.html index 22a1e3c..3de4280 100644 --- a/src/main/webapp/app/entities/encuesta/encuesta-password-dialog/encuesta-password-dialog.component.html +++ b/src/main/webapp/app/entities/encuesta/encuesta-password-dialog/encuesta-password-dialog.component.html @@ -1,12 +1,12 @@ -
-
-

ContraseƱa incorrecta

-
+ @@ -15,13 +15,7 @@  Cancel - diff --git a/src/main/webapp/app/entities/encuesta/encuesta-password-dialog/encuesta-password-dialog.component.ts b/src/main/webapp/app/entities/encuesta/encuesta-password-dialog/encuesta-password-dialog.component.ts index f2514e1..57294af 100644 --- a/src/main/webapp/app/entities/encuesta/encuesta-password-dialog/encuesta-password-dialog.component.ts +++ b/src/main/webapp/app/entities/encuesta/encuesta-password-dialog/encuesta-password-dialog.component.ts @@ -1,5 +1,4 @@ import { Component, OnInit } from '@angular/core'; -import { FormBuilder, Validators } from '@angular/forms'; import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; import { IEncuesta } from '../encuesta.model'; @@ -9,21 +8,16 @@ import { IEncuesta } from '../encuesta.model'; styleUrls: ['./encuesta-password-dialog.component.scss'], }) export class EncuestaPasswordDialogComponent implements OnInit { - passwordForm = this.fb.group({ - password: [null, [Validators.required]], - }); encuesta?: IEncuesta; isWrong?: boolean; passwordInput?: string; - constructor(protected activeModal: NgbActiveModal, protected fb: FormBuilder) {} + constructor(protected activeModal: NgbActiveModal) {} ngOnInit(): void {} submitPassword() { - const password = this.passwordForm.get(['password'])!.value; - - if (this.passwordForm.valid && password === this.encuesta!.contrasenna) { + if (this.passwordInput != undefined && this.passwordInput === this.encuesta!.contrasenna) { this.activeModal.close('success'); } else { this.isWrong = true; diff --git a/src/main/webapp/app/entities/encuesta/update/encuesta-update.component.html b/src/main/webapp/app/entities/encuesta/update/encuesta-update.component.html index b857f99..1023b54 100644 --- a/src/main/webapp/app/entities/encuesta/update/encuesta-update.component.html +++ b/src/main/webapp/app/entities/encuesta/update/encuesta-update.component.html @@ -58,7 +58,7 @@ [disabled]="isLoading" data-toggle="modal" data-target="#crearPregunta" - *ngIf="encuesta!.estado !== 'FINISHED' && (isAutor() || isEscritor())" + *ngIf="encuesta!.estado !== 'ACTIVE' && encuesta!.estado !== 'FINISHED' && (isAutor() || isEscritor())" >   Crear pregunta