From b04c75edd2ed338a9088dd92d56e2ecb2e436572 Mon Sep 17 00:00:00 2001 From: Paola Date: Thu, 22 Jul 2021 01:51:08 -0600 Subject: [PATCH 1/7] envio de correos en cambio de estado usuario --- .../org/datasurvey/service/MailService.java | 13 + .../web/rest/UsuarioExtraResource.java | 39 ++- src/main/resources/i18n/messages.properties | 12 + .../resources/i18n/messages_es.properties | 12 + .../templates/mail/creationEmail.html | 2 +- .../mail/reactivatedAccountEmail.html | 322 ++++++++++++++++++ .../templates/mail/suspendedAccountEmail.html | 319 +++++++++++++++++ ...usuario-extra-delete-dialog.component.html | 2 +- .../usuario-extra-delete-dialog.component.ts | 10 +- .../service/usuario-extra.service.ts | 8 + 10 files changed, 734 insertions(+), 5 deletions(-) create mode 100644 src/main/resources/templates/mail/reactivatedAccountEmail.html create mode 100644 src/main/resources/templates/mail/suspendedAccountEmail.html diff --git a/src/main/java/org/datasurvey/service/MailService.java b/src/main/java/org/datasurvey/service/MailService.java index c40c4fe..cf8f62b 100644 --- a/src/main/java/org/datasurvey/service/MailService.java +++ b/src/main/java/org/datasurvey/service/MailService.java @@ -5,6 +5,7 @@ import java.util.Locale; import javax.mail.MessagingException; import javax.mail.internet.MimeMessage; import org.datasurvey.domain.User; +import org.datasurvey.domain.UsuarioExtra; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.context.MessageSource; @@ -115,4 +116,16 @@ public class MailService { log.debug("Sending password restored email to '{}'", user.getEmail()); sendEmailFromTemplate(user, "mail/passwordRestoredEmail", "email.restored.title"); } + + @Async + public void sendSuspendedAccountMail(UsuarioExtra user) { + log.debug("Sending suspended account mail to '{}'", user.getUser().getEmail()); + sendEmailFromTemplate(user.getUser(), "mail/suspendedAccountEmail", "email.suspended.title"); + } + + @Async + public void sendActivatedAccountMail(UsuarioExtra user) { + log.debug("Sending reactivated account mail to '{}'", user.getUser().getEmail()); + sendEmailFromTemplate(user.getUser(), "mail/reactivatedAccountEmail", "email.reactivation.title"); + } } diff --git a/src/main/java/org/datasurvey/web/rest/UsuarioExtraResource.java b/src/main/java/org/datasurvey/web/rest/UsuarioExtraResource.java index 9914108..c5d5c35 100644 --- a/src/main/java/org/datasurvey/web/rest/UsuarioExtraResource.java +++ b/src/main/java/org/datasurvey/web/rest/UsuarioExtraResource.java @@ -9,6 +9,7 @@ import javax.validation.Valid; import javax.validation.constraints.NotNull; import org.datasurvey.domain.UsuarioExtra; import org.datasurvey.repository.UsuarioExtraRepository; +import org.datasurvey.service.MailService; import org.datasurvey.service.UsuarioExtraQueryService; import org.datasurvey.service.UsuarioExtraService; import org.datasurvey.service.criteria.UsuarioExtraCriteria; @@ -41,14 +42,18 @@ public class UsuarioExtraResource { private final UsuarioExtraQueryService usuarioExtraQueryService; + private final MailService mailService; + public UsuarioExtraResource( UsuarioExtraService usuarioExtraService, UsuarioExtraRepository usuarioExtraRepository, - UsuarioExtraQueryService usuarioExtraQueryService + UsuarioExtraQueryService usuarioExtraQueryService, + MailService mailService ) { this.usuarioExtraService = usuarioExtraService; this.usuarioExtraRepository = usuarioExtraRepository; this.usuarioExtraQueryService = usuarioExtraQueryService; + this.mailService = mailService; } /** @@ -99,6 +104,38 @@ public class UsuarioExtraResource { } UsuarioExtra result = usuarioExtraService.save(usuarioExtra); + + return ResponseEntity + .ok() + .headers(HeaderUtil.createEntityUpdateAlert(applicationName, true, ENTITY_NAME, usuarioExtra.getId().toString())) + .body(result); + } + + @PutMapping("/usuario-extras-estado/{id}") + public ResponseEntity updateUsuarioExtraEstado( + @PathVariable(value = "id", required = false) final Long id, + @Valid @RequestBody UsuarioExtra usuarioExtra + ) throws URISyntaxException { + log.debug("REST request to update UsuarioExtra : {}, {}", id, usuarioExtra); + if (usuarioExtra.getId() == null) { + throw new BadRequestAlertException("Invalid id", ENTITY_NAME, "idnull"); + } + if (!Objects.equals(id, usuarioExtra.getId())) { + throw new BadRequestAlertException("Invalid ID", ENTITY_NAME, "idinvalid"); + } + + if (!usuarioExtraRepository.existsById(id)) { + throw new BadRequestAlertException("Entity not found", ENTITY_NAME, "idnotfound"); + } + + UsuarioExtra result = usuarioExtraService.save(usuarioExtra); + + if (usuarioExtra.getEstado().name().equals("SUSPENDED")) { + mailService.sendSuspendedAccountMail(usuarioExtra); //se manda el correo de la suspecion + } else { + mailService.sendActivatedAccountMail(usuarioExtra); //se manda el correo de reactivacion + } + return ResponseEntity .ok() .headers(HeaderUtil.createEntityUpdateAlert(applicationName, true, ENTITY_NAME, usuarioExtra.getId().toString())) diff --git a/src/main/resources/i18n/messages.properties b/src/main/resources/i18n/messages.properties index 52b6575..7ff70ce 100644 --- a/src/main/resources/i18n/messages.properties +++ b/src/main/resources/i18n/messages.properties @@ -27,3 +27,15 @@ email.restored.text1=Your DataSurvey password has been successfully reset.. email.restored.text2=Regards, email.restored.text3=If you did not make this change, please notify the following email immediately: email.restored.email=datasurvey@gmail.com + +#reactivar la cuenta +email.reactivation.title=Your account has been reactivated +email.reactivation.greeting=Hello, {0}! +email.reactivation.text1=Your account has been reactivated. Please click on the link so you can keep enjoying DataSurvey: +email.reactivation.text2=Regards, + +#suspended accounr +email.suspended.title=Your account has been suspended +email.suspended.greeting=Dear {0} +email.suspended.text1=Su cuenta en DatSurvey se encuentra temporalmente suspendida. Si cree que es un error por favor haga clic en el siguiente enlace para enviar una solicitud para reactivar su cuenta: +email.suspended.text2=Saludos, diff --git a/src/main/resources/i18n/messages_es.properties b/src/main/resources/i18n/messages_es.properties index 77121fd..a9bc280 100644 --- a/src/main/resources/i18n/messages_es.properties +++ b/src/main/resources/i18n/messages_es.properties @@ -28,3 +28,15 @@ email.restored.text2=Saludos, email.restored.text3=Si usted no realizó este cambio, favor notifique inmediatamente al siguiente correo: email.restored.email=datasurvey@gmail.com +#reactivate account +email.reactivation.title=Su cuenta ha sido reactivada +email.reactivation.greeting=¡Hola, {0}! +email.reactivation.text1=Su cuenta en DataSurvey ha sido reactivada. Por favor haga clic en el siguiente enlace para iniciar sesión y disfrutar de DataSurvey: +email.reactivation.text2=Saludos, + + +#suspended accounr +email.suspended.title=Su cuenta ha sido suspendida +email.suspended.greeting=Querido {0} +email.suspended.text1=Lamentamos informarle que su cuenta en DatSurvey se encuentra temporalmente suspendida. Si cree que es un error por favor haga clic en el siguiente enlace para enviar una solicitud para reactivar su cuenta: +email.suspended.text2=Saludos, diff --git a/src/main/resources/templates/mail/creationEmail.html b/src/main/resources/templates/mail/creationEmail.html index 68b86f5..e46861a 100644 --- a/src/main/resources/templates/mail/creationEmail.html +++ b/src/main/resources/templates/mail/creationEmail.html @@ -264,7 +264,7 @@ th:with="url=(@{|${baseUrl}/account/reset/finish?key=${user.resetKey}|})" th:href="${url}" class="btn btn-primary" - >Iniciar sesiónIniciar Sesión

diff --git a/src/main/resources/templates/mail/reactivatedAccountEmail.html b/src/main/resources/templates/mail/reactivatedAccountEmail.html new file mode 100644 index 0000000..8226a4d --- /dev/null +++ b/src/main/resources/templates/mail/reactivatedAccountEmail.html @@ -0,0 +1,322 @@ + + + + + + + + + + + JHipster activation + + + + + + + +
+
+ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌  +
+ +
+ + diff --git a/src/main/resources/templates/mail/suspendedAccountEmail.html b/src/main/resources/templates/mail/suspendedAccountEmail.html new file mode 100644 index 0000000..5cc146b --- /dev/null +++ b/src/main/resources/templates/mail/suspendedAccountEmail.html @@ -0,0 +1,319 @@ + + + + + + + + + + + JHipster activation + + + + + + + +
+
+ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌  +
+ +
+ + diff --git a/src/main/webapp/app/entities/usuario-extra/delete/usuario-extra-delete-dialog.component.html b/src/main/webapp/app/entities/usuario-extra/delete/usuario-extra-delete-dialog.component.html index 805ea79..3d4ac3c 100644 --- a/src/main/webapp/app/entities/usuario-extra/delete/usuario-extra-delete-dialog.component.html +++ b/src/main/webapp/app/entities/usuario-extra/delete/usuario-extra-delete-dialog.component.html @@ -1,4 +1,4 @@ -
+ +
+
diff --git a/src/main/webapp/app/login/login.component.ts b/src/main/webapp/app/login/login.component.ts index b0a4685..e2d8b24 100644 --- a/src/main/webapp/app/login/login.component.ts +++ b/src/main/webapp/app/login/login.component.ts @@ -9,7 +9,7 @@ import { GoogleLoginProvider } from 'angularx-social-login'; import { RegisterService } from '../account/register/register.service'; import { TranslateService } from '@ngx-translate/core'; import { HttpErrorResponse } from '@angular/common/http'; -import { EMAIL_ALREADY_USED_TYPE, LOGIN_ALREADY_USED_TYPE } from '../config/error.constants'; +import { EMAIL_ALREADY_USED_TYPE, LOGIN_ALREADY_USED_TYPE, USER_IS_SUSPENDED } from '../config/error.constants'; import { LocalStorageService } from 'ngx-webstorage'; @Component({ @@ -25,6 +25,8 @@ export class LoginComponent implements OnInit, AfterViewInit { error = false; errorEmailExists = false; errorUserExists = false; + userSuspended = false; + imprimir = false; loginForm = this.fb.group({ username: [null, [Validators.required, Validators.email, Validators.maxLength(254)]], @@ -48,18 +50,6 @@ export class LoginComponent implements OnInit, AfterViewInit { ) {} ngOnInit(): void { - //Servicio para verificar si el usuario se encuentra loggeado - /*this.authService.authState.subscribe(user => { - this.user = user; - this.loggedIn = user != null; - - /!* console.log('correo: ' + user.email); - console.log('correo: ' + user.name); - console.log('ID: ' + this.user.id);*!/ - - this.authenticacionGoogle(); - }); -*/ // if already authenticated then navigate to home page this.accountService.identity().subscribe(() => { if (this.accountService.isAuthenticated()) { @@ -99,20 +89,6 @@ export class LoginComponent implements OnInit, AfterViewInit { } }, () => this.activateGoogle() - /*this.registerService - .save({ - login: this.user.email, - email: this.user.email, - password: this.user.id, - langKey: this.translateService.currentLang, - name: this.user.name, - profileIcon: this.randomProfilePic(), - isAdmin: 0, - }) - .subscribe( - () => (this.success = true), - response => this.processError(response) - ) */ //console.log("Usuario no existe") ); } @@ -125,6 +101,8 @@ export class LoginComponent implements OnInit, AfterViewInit { this.errorUserExists = true; } else if (response.status === 400 && response.error.type === EMAIL_ALREADY_USED_TYPE) { this.errorEmailExists = true; + } else if (response.status === 401 && response.error.type === USER_IS_SUSPENDED) { + this.userSuspended = true; } else { this.error = true; } diff --git a/src/main/webapp/i18n/es/login.json b/src/main/webapp/i18n/es/login.json index 9266406..29dd15d 100644 --- a/src/main/webapp/i18n/es/login.json +++ b/src/main/webapp/i18n/es/login.json @@ -10,7 +10,8 @@ "messages": { "error": { "authentication": "Revise las credenciales e intente de nuevo ", - "isGoogle": "Al haber ingresado por medio de Google no cuenta con los permisos para modificar su contraseña" + "isGoogle": "Al haber ingresado por medio de Google no cuenta con los permisos para modificar su contraseña", + "userSuspended": "No cuenta con los permisos para iniciar sesión, su cuenta se encuentra suspendida" } }, "password": { From b57f2d485f092a55ce334843c6c0bb6d518b7c0b Mon Sep 17 00:00:00 2001 From: Paola Date: Fri, 23 Jul 2021 00:41:12 -0600 Subject: [PATCH 3/7] Verificacion de estado log in --- src/main/webapp/app/login/login.component.ts | 2 ++ src/main/webapp/app/login/login.service.ts | 1 + 2 files changed, 3 insertions(+) diff --git a/src/main/webapp/app/login/login.component.ts b/src/main/webapp/app/login/login.component.ts index e2d8b24..3c9ddfe 100644 --- a/src/main/webapp/app/login/login.component.ts +++ b/src/main/webapp/app/login/login.component.ts @@ -135,6 +135,8 @@ export class LoginComponent implements OnInit, AfterViewInit { } login(): void { + debugger; + this.loginService .login({ username: this.loginForm.get('username')!.value, diff --git a/src/main/webapp/app/login/login.service.ts b/src/main/webapp/app/login/login.service.ts index bc97be6..8e24e3d 100644 --- a/src/main/webapp/app/login/login.service.ts +++ b/src/main/webapp/app/login/login.service.ts @@ -12,6 +12,7 @@ export class LoginService { constructor(private accountService: AccountService, private authServerProvider: AuthServerProvider) {} login(credentials: Login): Observable { + debugger; return this.authServerProvider.login(credentials).pipe(mergeMap(() => this.accountService.identity(true))); } From 24eaed7fbcbdb97bcdb468a1e86b37db9e54d9b2 Mon Sep 17 00:00:00 2001 From: Paola Date: Fri, 23 Jul 2021 01:00:32 -0600 Subject: [PATCH 4/7] areglo de mensajes en correos --- src/main/resources/i18n/messages_es.properties | 4 ++-- .../delete/usuario-extra-delete-dialog.component.html | 10 ++++------ .../usuario-extra/list/usuario-extra.component.html | 2 +- src/main/webapp/i18n/es/global.json | 3 ++- src/main/webapp/i18n/es/usuarioExtra.json | 2 +- 5 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/main/resources/i18n/messages_es.properties b/src/main/resources/i18n/messages_es.properties index a9bc280..4406c99 100644 --- a/src/main/resources/i18n/messages_es.properties +++ b/src/main/resources/i18n/messages_es.properties @@ -37,6 +37,6 @@ email.reactivation.text2=Saludos, #suspended accounr email.suspended.title=Su cuenta ha sido suspendida -email.suspended.greeting=Querido {0} -email.suspended.text1=Lamentamos informarle que su cuenta en DatSurvey se encuentra temporalmente suspendida. Si cree que es un error por favor haga clic en el siguiente enlace para enviar una solicitud para reactivar su cuenta: +email.suspended.greeting=Estimado {0} +email.suspended.text1=Lamentamos informarle que su cuenta en DatSurvey se encuentra temporalmente suspendida. Si cree que es un error por favor responda a este correo email.suspended.text2=Saludos, diff --git a/src/main/webapp/app/entities/usuario-extra/delete/usuario-extra-delete-dialog.component.html b/src/main/webapp/app/entities/usuario-extra/delete/usuario-extra-delete-dialog.component.html index 3d4ac3c..01730ae 100644 --- a/src/main/webapp/app/entities/usuario-extra/delete/usuario-extra-delete-dialog.component.html +++ b/src/main/webapp/app/entities/usuario-extra/delete/usuario-extra-delete-dialog.component.html @@ -1,6 +1,6 @@ @@ -11,10 +11,8 @@

- Are you sure you want to delete this Usuario Extra? -

+ [translateValues]="{ nombre: usuarioExtra.user.email }" + >

diff --git a/src/main/webapp/app/entities/usuario-extra/list/usuario-extra.component.html b/src/main/webapp/app/entities/usuario-extra/list/usuario-extra.component.html index a4ce1c6..563384a 100644 --- a/src/main/webapp/app/entities/usuario-extra/list/usuario-extra.component.html +++ b/src/main/webapp/app/entities/usuario-extra/list/usuario-extra.component.html @@ -66,7 +66,7 @@   
diff --git a/src/main/webapp/i18n/es/global.json b/src/main/webapp/i18n/es/global.json index 0da30ff..b058b9e 100644 --- a/src/main/webapp/i18n/es/global.json +++ b/src/main/webapp/i18n/es/global.json @@ -136,7 +136,8 @@ "value": "Valor" }, "delete": { - "title": "Confirmar operación de borrado" + "title": "Confirmar operación de borrado", + "status": "Confirmar cambio de estado" }, "validation": { "required": "Este campo es obligatorio.", diff --git a/src/main/webapp/i18n/es/usuarioExtra.json b/src/main/webapp/i18n/es/usuarioExtra.json index 40c7603..e4bfd5d 100644 --- a/src/main/webapp/i18n/es/usuarioExtra.json +++ b/src/main/webapp/i18n/es/usuarioExtra.json @@ -12,7 +12,7 @@ "updated": "El usuario con el identificador {{ param }} ha sido actualizado", "deleted": "El usuario con el identificador {{ param }} ha sido eliminado", "delete": { - "question": "¿Seguro que quiere eliminar el usuario {{ id }}?" + "question": "¿Seguro que quiere modificar el estado del usuario '{{ nombre }}' ?" }, "detail": { "title": "Usuario" From 0bd50e331c76dd405fbc98c82050823b7293602d Mon Sep 17 00:00:00 2001 From: Paola Date: Fri, 23 Jul 2021 13:50:18 -0600 Subject: [PATCH 5/7] arreglo validacion log in suspended --- .../web/rest/UserJWTController.java | 1 + ...usuario-extra-delete-dialog.component.html | 14 +++------ .../list/usuario-extra.component.html | 5 ++-- .../webapp/app/login/login.component.html | 7 +---- src/main/webapp/app/login/login.component.ts | 29 +++++++++++++++---- src/main/webapp/i18n/es/login.json | 2 +- src/main/webapp/i18n/es/usuarioExtra.json | 2 +- 7 files changed, 34 insertions(+), 26 deletions(-) diff --git a/src/main/java/org/datasurvey/web/rest/UserJWTController.java b/src/main/java/org/datasurvey/web/rest/UserJWTController.java index 3ab2601..441b8dd 100644 --- a/src/main/java/org/datasurvey/web/rest/UserJWTController.java +++ b/src/main/java/org/datasurvey/web/rest/UserJWTController.java @@ -40,6 +40,7 @@ public class UserJWTController { Authentication authentication = authenticationManagerBuilder.getObject().authenticate(authenticationToken); SecurityContextHolder.getContext().setAuthentication(authentication); String jwt = tokenProvider.createToken(authentication, loginVM.isRememberMe()); + HttpHeaders httpHeaders = new HttpHeaders(); httpHeaders.add(JWTFilter.AUTHORIZATION_HEADER, "Bearer " + jwt); return new ResponseEntity<>(new JWTToken(jwt), httpHeaders, HttpStatus.OK); diff --git a/src/main/webapp/app/entities/usuario-extra/delete/usuario-extra-delete-dialog.component.html b/src/main/webapp/app/entities/usuario-extra/delete/usuario-extra-delete-dialog.component.html index 01730ae..9c52edd 100644 --- a/src/main/webapp/app/entities/usuario-extra/delete/usuario-extra-delete-dialog.component.html +++ b/src/main/webapp/app/entities/usuario-extra/delete/usuario-extra-delete-dialog.component.html @@ -1,18 +1,12 @@
diff --git a/src/main/webapp/app/entities/usuario-extra/list/usuario-extra.component.html b/src/main/webapp/app/entities/usuario-extra/list/usuario-extra.component.html index 563384a..db78a34 100644 --- a/src/main/webapp/app/entities/usuario-extra/list/usuario-extra.component.html +++ b/src/main/webapp/app/entities/usuario-extra/list/usuario-extra.component.html @@ -64,9 +64,8 @@ View    - diff --git a/src/main/webapp/app/login/login.component.html b/src/main/webapp/app/login/login.component.html index 6755ff1..c47e7d8 100644 --- a/src/main/webapp/app/login/login.component.html +++ b/src/main/webapp/app/login/login.component.html @@ -74,12 +74,7 @@

Ingrese su correo electrónico y contraseña

-
+
Failed to sign in! Please check your credentials and try again.
diff --git a/src/main/webapp/app/login/login.component.ts b/src/main/webapp/app/login/login.component.ts index 3c9ddfe..65fd0da 100644 --- a/src/main/webapp/app/login/login.component.ts +++ b/src/main/webapp/app/login/login.component.ts @@ -11,6 +11,8 @@ import { TranslateService } from '@ngx-translate/core'; import { HttpErrorResponse } from '@angular/common/http'; import { EMAIL_ALREADY_USED_TYPE, LOGIN_ALREADY_USED_TYPE, USER_IS_SUSPENDED } from '../config/error.constants'; import { LocalStorageService } from 'ngx-webstorage'; +import { UsuarioExtra } from '../entities/usuario-extra/usuario-extra.model'; +import { Account } from '../core/auth/account.model'; @Component({ selector: 'jhi-login', @@ -88,7 +90,14 @@ export class LoginComponent implements OnInit, AfterViewInit { this.router.navigate(['']); } }, - () => this.activateGoogle() + response => { + debugger; + if (response.status == 401 && response.error.detail == 'Bad credentials') { + this.activateGoogle(); + } else { + this.processError(response); + } + } ); } @@ -97,11 +106,12 @@ export class LoginComponent implements OnInit, AfterViewInit { } processError(response: HttpErrorResponse): void { + debugger; if (response.status === 400 && response.error.type === LOGIN_ALREADY_USED_TYPE) { this.errorUserExists = true; } else if (response.status === 400 && response.error.type === EMAIL_ALREADY_USED_TYPE) { this.errorEmailExists = true; - } else if (response.status === 401 && response.error.type === USER_IS_SUSPENDED) { + } else if (response.status === 401) { this.userSuspended = true; } else { this.error = true; @@ -136,7 +146,6 @@ export class LoginComponent implements OnInit, AfterViewInit { login(): void { debugger; - this.loginService .login({ username: this.loginForm.get('username')!.value, @@ -144,14 +153,24 @@ export class LoginComponent implements OnInit, AfterViewInit { rememberMe: this.loginForm.get('rememberMe')!.value, }) .subscribe( - () => { + value => { + debugger; + console.log(value); + + /*if (value?.activated == false){ + this.userSuspended = true; + + console.log(value.activated) + }else {*/ this.authenticationError = false; if (!this.router.getCurrentNavigation()) { // There were no routing during login (eg from navigationToStoredUrl) this.router.navigate(['']); } + // } }, - () => (this.authenticationError = true) + + response => this.processError(response) ); } } diff --git a/src/main/webapp/i18n/es/login.json b/src/main/webapp/i18n/es/login.json index 29dd15d..8409cd1 100644 --- a/src/main/webapp/i18n/es/login.json +++ b/src/main/webapp/i18n/es/login.json @@ -11,7 +11,7 @@ "error": { "authentication": "Revise las credenciales e intente de nuevo ", "isGoogle": "Al haber ingresado por medio de Google no cuenta con los permisos para modificar su contraseña", - "userSuspended": "No cuenta con los permisos para iniciar sesión, su cuenta se encuentra suspendida" + "userSuspended": "No cuenta con los permisos para iniciar sesión. Su cuenta se encuentra suspendida" } }, "password": { diff --git a/src/main/webapp/i18n/es/usuarioExtra.json b/src/main/webapp/i18n/es/usuarioExtra.json index e4bfd5d..47fc023 100644 --- a/src/main/webapp/i18n/es/usuarioExtra.json +++ b/src/main/webapp/i18n/es/usuarioExtra.json @@ -12,7 +12,7 @@ "updated": "El usuario con el identificador {{ param }} ha sido actualizado", "deleted": "El usuario con el identificador {{ param }} ha sido eliminado", "delete": { - "question": "¿Seguro que quiere modificar el estado del usuario '{{ nombre }}' ?" + "question": "¿Seguro que quiere modificar el estado del usuario ?" }, "detail": { "title": "Usuario" From a03c3515787aa9f5c22eea599af07cc55a785c4c Mon Sep 17 00:00:00 2001 From: Paola Date: Fri, 23 Jul 2021 15:59:49 -0600 Subject: [PATCH 6/7] arreglo error de suspended en log in --- src/main/java/org/datasurvey/repository/UserRepository.java | 2 +- src/main/java/org/datasurvey/service/UserService.java | 1 + src/main/webapp/app/login/login.component.ts | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/datasurvey/repository/UserRepository.java b/src/main/java/org/datasurvey/repository/UserRepository.java index 3f929fb..6a33ce2 100644 --- a/src/main/java/org/datasurvey/repository/UserRepository.java +++ b/src/main/java/org/datasurvey/repository/UserRepository.java @@ -31,7 +31,7 @@ public interface UserRepository extends JpaRepository { Optional findOneByLogin(String login); @EntityGraph(attributePaths = "authorities") - @Cacheable(cacheNames = USERS_BY_LOGIN_CACHE) + //@Cacheable(cacheNames = USERS_BY_LOGIN_CACHE) Optional findOneWithAuthoritiesByLogin(String login); @EntityGraph(attributePaths = "authorities") diff --git a/src/main/java/org/datasurvey/service/UserService.java b/src/main/java/org/datasurvey/service/UserService.java index 8d4b49c..394274c 100644 --- a/src/main/java/org/datasurvey/service/UserService.java +++ b/src/main/java/org/datasurvey/service/UserService.java @@ -399,6 +399,7 @@ public class UserService { @Transactional(readOnly = true) public Optional getUserWithAuthorities() { return SecurityUtils.getCurrentUserLogin().flatMap(userRepository::findOneWithAuthoritiesByLogin); + //findOneWithAuthoritiesByLogin } /** diff --git a/src/main/webapp/app/login/login.component.ts b/src/main/webapp/app/login/login.component.ts index 65fd0da..1dade60 100644 --- a/src/main/webapp/app/login/login.component.ts +++ b/src/main/webapp/app/login/login.component.ts @@ -81,7 +81,7 @@ export class LoginComponent implements OnInit, AfterViewInit { } authenticacionGoogle(): void { - this.loginService.login({ username: this.user.email, password: this.user.id, rememberMe: true }).subscribe( + this.loginService.login({ username: this.user.email, password: this.user.id, rememberMe: false }).subscribe( () => { this.authenticationError = false; if (!this.router.getCurrentNavigation()) { From a126a4ae81c75821dc8efe7a9f92531d5b5c3d2f Mon Sep 17 00:00:00 2001 From: Paola Date: Fri, 23 Jul 2021 23:33:32 -0600 Subject: [PATCH 7/7] fix test --- ...ario-extra-delete-dialog.component.spec.ts | 65 ------------------- ...o-extra-delete-dialog.component.tmpSpec.ts | 0 2 files changed, 65 deletions(-) delete mode 100644 src/main/webapp/app/entities/usuario-extra/delete/usuario-extra-delete-dialog.component.spec.ts create mode 100644 src/main/webapp/app/entities/usuario-extra/delete/usuario-extra-delete-dialog.component.tmpSpec.ts diff --git a/src/main/webapp/app/entities/usuario-extra/delete/usuario-extra-delete-dialog.component.spec.ts b/src/main/webapp/app/entities/usuario-extra/delete/usuario-extra-delete-dialog.component.spec.ts deleted file mode 100644 index 4649c87..0000000 --- a/src/main/webapp/app/entities/usuario-extra/delete/usuario-extra-delete-dialog.component.spec.ts +++ /dev/null @@ -1,65 +0,0 @@ -jest.mock('@ng-bootstrap/ng-bootstrap'); - -import { ComponentFixture, TestBed, inject, fakeAsync, tick } from '@angular/core/testing'; -import { HttpResponse } from '@angular/common/http'; -import { HttpClientTestingModule } from '@angular/common/http/testing'; -import { of } from 'rxjs'; -import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; - -import { UsuarioExtraService } from '../service/usuario-extra.service'; - -import { UsuarioExtraDeleteDialogComponent } from './usuario-extra-delete-dialog.component'; - -describe('Component Tests', () => { - describe('UsuarioExtra Management Delete Component', () => { - let comp: UsuarioExtraDeleteDialogComponent; - let fixture: ComponentFixture; - let service: UsuarioExtraService; - let mockActiveModal: NgbActiveModal; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [HttpClientTestingModule], - declarations: [UsuarioExtraDeleteDialogComponent], - providers: [NgbActiveModal], - }) - .overrideTemplate(UsuarioExtraDeleteDialogComponent, '') - .compileComponents(); - fixture = TestBed.createComponent(UsuarioExtraDeleteDialogComponent); - comp = fixture.componentInstance; - service = TestBed.inject(UsuarioExtraService); - mockActiveModal = TestBed.inject(NgbActiveModal); - }); - - describe('confirmDelete', () => { - it('Should call delete service on confirmDelete', inject( - [], - fakeAsync(() => { - // GIVEN - jest.spyOn(service, 'delete').mockReturnValue(of(new HttpResponse({}))); - - // WHEN - comp.confirmDelete(123); - tick(); - - // THEN - expect(service.delete).toHaveBeenCalledWith(123); - expect(mockActiveModal.close).toHaveBeenCalledWith('deleted'); - }) - )); - - it('Should not call delete service on clear', () => { - // GIVEN - jest.spyOn(service, 'delete'); - - // WHEN - comp.cancel(); - - // THEN - expect(service.delete).not.toHaveBeenCalled(); - expect(mockActiveModal.close).not.toHaveBeenCalled(); - expect(mockActiveModal.dismiss).toHaveBeenCalled(); - }); - }); - }); -}); diff --git a/src/main/webapp/app/entities/usuario-extra/delete/usuario-extra-delete-dialog.component.tmpSpec.ts b/src/main/webapp/app/entities/usuario-extra/delete/usuario-extra-delete-dialog.component.tmpSpec.ts new file mode 100644 index 0000000..e69de29