arreglo validacion log in suspended
This commit is contained in:
parent
24eaed7fbc
commit
0bd50e331c
|
@ -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);
|
||||
|
|
|
@ -1,18 +1,12 @@
|
|||
<form *ngIf="usuarioExtra" name="deleteForm" (ngSubmit)="confirmDelete(usuarioExtra)">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" data-cy="usuarioExtraDeleteDialogHeading" jhiTranslate="entity.delete.status">Confirm delete operation</h4>
|
||||
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true" (click)="cancel()">×</button>
|
||||
<!--<h4 class="modal-title" data-cy="usuarioExtraDeleteDialogHeading" jhiTranslate="entity.delete.status">Confirm delete operation</h4>-->
|
||||
</div>
|
||||
|
||||
<div class="modal-body">
|
||||
<jhi-alert-error></jhi-alert-error>
|
||||
|
||||
<p
|
||||
id="jhi-delete-usuarioExtra-heading"
|
||||
jhiTranslate="dataSurveyApp.usuarioExtra.delete.question"
|
||||
[translateValues]="{ nombre: usuarioExtra.user.email }"
|
||||
></p>
|
||||
<p id="jhi-delete-usuarioExtra-heading" jhiTranslate="dataSurveyApp.usuarioExtra.delete.question"></p>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
|
@ -20,8 +14,8 @@
|
|||
<fa-icon icon="ban"></fa-icon> <span jhiTranslate="entity.action.cancel">Cancel</span>
|
||||
</button>
|
||||
|
||||
<button id="jhi-confirm-delete-usuarioExtra" data-cy="entityConfirmDeleteButton" type="submit" class="btn btn-danger">
|
||||
<fa-icon icon="times"></fa-icon> <span jhiTranslate="entity.action.toggleStatus">Cambiar estado</span>
|
||||
<button id="jhi-confirm-delete-usuarioExtra" data-cy="entityConfirmDeleteButton" type="submit" class="btn btn-warning">
|
||||
<span jhiTranslate="entity.action.toggleStatus">Cambiar estado</span>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
|
|
|
@ -64,9 +64,8 @@
|
|||
<span class="d-none d-md-inline" jhiTranslate="entity.action.view">View</span>
|
||||
</button>
|
||||
|
||||
<button type="submit" (click)="delete(usuarioExtra)" class="ds-btn ds-btn--danger btn-sm" data-cy="entityDeleteButton">
|
||||
<fa-icon icon="times"></fa-icon>
|
||||
<span class="d-none d-md-inline" jhiTranslate="entity.action.delete"></span>
|
||||
<button type="submit" (click)="delete(usuarioExtra)" class="btn-sm ds-btn ds-btn--toggle" data-cy="entityDeleteButton">
|
||||
<span class="d-none d-md-inline" jhiTranslate="entity.action.toggleStatus"></span>
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
|
|
|
@ -74,12 +74,7 @@
|
|||
<p class="mb-4" style="color: rgba(146, 146, 146, 0.664)">Ingrese su correo electrónico y contraseña</p>
|
||||
</div>
|
||||
|
||||
<div
|
||||
class="alert alert-danger"
|
||||
*ngIf="authenticationError"
|
||||
jhiTranslate="login.messages.error.authentication"
|
||||
data-cy="loginError"
|
||||
>
|
||||
<div class="alert alert-danger" *ngIf="error" jhiTranslate="login.messages.error.authentication" data-cy="loginError">
|
||||
<strong>Failed to sign in!</strong> Please check your credentials and try again.
|
||||
</div>
|
||||
|
||||
|
|
|
@ -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)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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": {
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in New Issue