aboutsummaryrefslogtreecommitdiff
path: root/frontend/src/app/_modals/login-modal/login-modal.component.ts
diff options
context:
space:
mode:
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.ts21
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;
+ }
}