From adbd70386b4fa13c940eed643cd1b252b5243051 Mon Sep 17 00:00:00 2001 From: Sonja Galovic Date: Thu, 28 Apr 2022 14:22:49 +0200 Subject: Redizajn login modala uradjen. --- .../src/app/_modals/login-modal/login-modal.component.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'frontend/src/app/_modals/login-modal/login-modal.component.ts') diff --git a/frontend/src/app/_modals/login-modal/login-modal.component.ts b/frontend/src/app/_modals/login-modal/login-modal.component.ts index b28d9799..f69e1cff 100644 --- a/frontend/src/app/_modals/login-modal/login-modal.component.ts +++ b/frontend/src/app/_modals/login-modal/login-modal.component.ts @@ -14,10 +14,13 @@ import {AfterViewInit, ElementRef} from '@angular/core'; export class LoginModalComponent implements OnInit { @ViewChild('closeButton') closeButton?: ElementRef; + @ViewChild('pass') passwordInput!: ElementRef; username: string = ''; password: string = ''; + passwordShown: boolean = false; + wrongCreds: boolean = false; constructor( @@ -37,6 +40,8 @@ export class LoginModalComponent implements OnInit { if (response == "Username doesn't exist" || response == "Wrong password") { this.wrongCreds = true; this.password = ''; + this.passwordShown = false; + this.passwordInput.nativeElement.type = "password"; } else { this.authService.authenticate(response); @@ -57,4 +62,13 @@ export class LoginModalComponent implements OnInit { this.username = ''; this.password = ''; } + + togglePasswordShown() { + this.passwordShown = !this.passwordShown; + + if (this.passwordShown) + this.passwordInput.nativeElement.type = "text"; + else + this.passwordInput.nativeElement.type = "password"; + } } -- cgit v1.2.3