diff options
author | Danijel Andjelkovic <adanijel99@gmail.com> | 2022-05-05 00:46:39 +0000 |
---|---|---|
committer | Danijel Andjelkovic <adanijel99@gmail.com> | 2022-05-05 00:46:39 +0000 |
commit | c77c5289d01f1f02a57a060dc2166b449e597881 (patch) | |
tree | cb64f2775335cdd856e81ec9e8ba0bed93fa0985 /frontend/src/app/_modals/login-modal/login-modal.component.ts | |
parent | 6f48458e058d3e5a8d559adc22adbe78cba9a253 (diff) | |
parent | 15c60cb0c179d2d3c353ab3e19370e16d02176eb (diff) |
Merge branch 'redesign' into 'master'
merge
See merge request igrannonica/neuronstellar!29
Diffstat (limited to 'frontend/src/app/_modals/login-modal/login-modal.component.ts')
-rw-r--r-- | frontend/src/app/_modals/login-modal/login-modal.component.ts | 21 |
1 files changed, 21 insertions, 0 deletions
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..ccd78509 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,14 +40,19 @@ 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.wrongCreds = false; this.authService.authenticate(response); (<HTMLSelectElement>this.closeButton?.nativeElement).click(); this.userInfoService.getUserInfo().subscribe((response) => { shared.photoId = response.photoId; }); + location.reload(); } + }); } else { @@ -57,4 +65,17 @@ 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"; + } + + cleanWarnings() { + this.wrongCreds = false; + } } |