Login - show password bug fix
parent
742a9ad72b
commit
852f894605
|
@ -1,32 +1,30 @@
|
|||
<div>
|
||||
<form class="login" (ngSubmit)="onLogin()" #loginForm="ngForm" (keydown.enter)="onLogin()">
|
||||
<img src="assets/images/logo.png" alt="Opengnsys"
|
||||
class="login-logo" [class.rotating]="isLoading">
|
||||
<h2 i18n="@@headerOpengnsys">Opengnsys</h2>
|
||||
<mat-form-field>
|
||||
<mat-label i18n="@@loginlabelUsername">Introduce tu usuario</mat-label>
|
||||
<input matInput [(ngModel)]="loginObj.username" name="username" required #usernameInput="ngModel" [ngClass]="{'invalid': !usernameInput.valid && usernameInput.touched}" />
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<mat-label i18n="@@loginlabelPassword">Introduce tu contraseña</mat-label>
|
||||
<input matInput (keydown.enter)="$event.preventDefault()" [type]="hide() ? 'password' : 'text'" required [(ngModel)]="loginObj.password" name="password"/>
|
||||
<button
|
||||
mat-icon-button
|
||||
matSuffix
|
||||
(click)="clickEvent()"
|
||||
[attr.aria-label]="'Ocultar contraseña'"
|
||||
>
|
||||
<mat-icon>{{hide() ? 'visibility_off' : 'visibility'}}</mat-icon>
|
||||
</button>
|
||||
</mat-form-field>
|
||||
<div class="button-row">
|
||||
<button mat-flat-button color="primary" type="submit" [disabled]="!loginObj.username || !loginObj.password" i18n="@@buttonLogin">Iniciar sesión</button>
|
||||
</div>
|
||||
<img src="assets/images/logo.png" alt="Opengnsys" class="login-logo" [class.rotating]="isLoading">
|
||||
<h2 i18n="@@headerOpengnsys">Opengnsys</h2>
|
||||
<mat-form-field>
|
||||
<mat-label i18n="@@loginlabelUsername">Introduce tu usuario</mat-label>
|
||||
<input matInput [(ngModel)]="loginObj.username" name="username" required #usernameInput="ngModel"
|
||||
[ngClass]="{'invalid': !usernameInput.valid && usernameInput.touched}" />
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<mat-label i18n="@@loginlabelPassword">Introduce tu contraseña</mat-label>
|
||||
<input matInput (keydown.enter)="$event.preventDefault()" [type]="hide() ? 'password' : 'text'" required
|
||||
[(ngModel)]="loginObj.password" name="password" />
|
||||
<button mat-icon-button matSuffix (click)="clickEvent($event)" [attr.aria-label]="'Ocultar contraseña'">
|
||||
<mat-icon>{{hide() ? 'visibility_off' : 'visibility'}}</mat-icon>
|
||||
</button>
|
||||
|
||||
</mat-form-field>
|
||||
<div class="button-row">
|
||||
<button mat-flat-button color="primary" type="submit" [disabled]="!loginObj.username || !loginObj.password"
|
||||
i18n="@@buttonLogin">Iniciar sesión</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
<!-- BORRAR DESPUES DE LA DEMO -->
|
||||
<button mat-flat-button (click)="redirectToUrl1()">Español</button>
|
||||
<button mat-flat-button (click)="redirectToUrl1()">Español</button>
|
||||
|
||||
<!-- Botón para redirigir a http://localhost:4200/auth/login -->
|
||||
<button mat-flat-button (click)="redirectToUrl2()">Inglés</button>
|
||||
<button mat-flat-button (click)="redirectToUrl2()">Inglés</button>
|
|
@ -45,7 +45,6 @@ export class LoginComponent {
|
|||
return;
|
||||
}
|
||||
|
||||
// Usar la URL base de la variable de entorno
|
||||
this.http.post(`${this.baseUrl}/auth/login`, this.loginObj).subscribe({
|
||||
next: (res: any) => {
|
||||
if (res.token) {
|
||||
|
@ -65,7 +64,8 @@ export class LoginComponent {
|
|||
}
|
||||
|
||||
hide = signal(true);
|
||||
clickEvent() {
|
||||
clickEvent(event: Event) {
|
||||
event.stopPropagation();
|
||||
this.hide.set(!this.hide());
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue