From 9f23887793e02b85322bb1138b9b4d373d906dab Mon Sep 17 00:00:00 2001 From: Eduardo Quiros Date: Tue, 17 Aug 2021 22:25:18 -0600 Subject: [PATCH 1/2] apply stash --- .../encuesta/complete/complete.component.ts | 19 ++++++++----------- .../encuesta-password-dialog.component.html | 12 +++--------- .../update/encuesta-update.component.html | 2 +- 3 files changed, 12 insertions(+), 21 deletions(-) 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..6c72028 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,8 @@ 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(); + this.loadAll(); }); for (let pregunta of this.ePreguntas!) { if (pregunta.tipo && pregunta.tipo === PreguntaCerradaTipo.SINGLE) { @@ -89,17 +85,19 @@ export class EncuestaCompleteComponent implements OnInit { } } - verifyPassword(): boolean { + verifyPassword(): void { if (this.encuesta!.acceso === AccesoEncuesta.PUBLIC) { - return false; + 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(); + } }); } - return true; } ngAfterViewChecked(): void { @@ -194,7 +192,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..19a1371 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,5 +1,5 @@ -
-
+ +

Contraseña incorrecta

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 From f4ebb8ab48c132dcd1b78a64ef7d74bebbbff338 Mon Sep 17 00:00:00 2001 From: Eduardo Quiros Date: Tue, 17 Aug 2021 23:06:48 -0600 Subject: [PATCH 2/2] =?UTF-8?q?arreglar=20logica=20de=20contrase=C3=B1a?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../entities/encuesta/complete/complete.component.ts | 4 +++- .../encuesta-password-dialog.component.html | 8 ++++---- .../encuesta-password-dialog.component.ts | 10 ++-------- 3 files changed, 9 insertions(+), 13 deletions(-) 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 6c72028..07c6137 100644 --- a/src/main/webapp/app/entities/encuesta/complete/complete.component.ts +++ b/src/main/webapp/app/entities/encuesta/complete/complete.component.ts @@ -76,7 +76,6 @@ export class EncuestaCompleteComponent implements OnInit { this.sumCalificacion = this.avgCalificacion * this.cantidadCalificaciones; } this.verifyPassword(); - this.loadAll(); }); for (let pregunta of this.ePreguntas!) { if (pregunta.tipo && pregunta.tipo === PreguntaCerradaTipo.SINGLE) { @@ -87,6 +86,7 @@ export class EncuestaCompleteComponent implements OnInit { verifyPassword(): void { if (this.encuesta!.acceso === AccesoEncuesta.PUBLIC) { + this.loadAll(); this.isLocked = false; } else { const modalRef = this.modalService.open(EncuestaPasswordDialogComponent, { size: 'lg', backdrop: 'static' }); @@ -95,6 +95,8 @@ export class EncuestaCompleteComponent implements OnInit { this.isLocked = reason != 'success'; if (this.isLocked) { this.previousState(); + } else { + this.loadAll(); } }); } 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 19a1371..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,7 +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;