aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/login/login.component.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/login/login.component.ts')
-rw-r--r--client/src/app/login/login.component.ts8
1 files changed, 6 insertions, 2 deletions
diff --git a/client/src/app/login/login.component.ts b/client/src/app/login/login.component.ts
index 9d88536ca..768594ac4 100644
--- a/client/src/app/login/login.component.ts
+++ b/client/src/app/login/login.component.ts
@@ -9,6 +9,8 @@ import { AuthService, AuthStatus, User } from '../shared';
9}) 9})
10 10
11export class LoginComponent { 11export class LoginComponent {
12 error: string = null;
13
12 constructor( 14 constructor(
13 private authService: AuthService, 15 private authService: AuthService,
14 private router: Router 16 private router: Router
@@ -17,6 +19,8 @@ export class LoginComponent {
17 login(username: string, password: string) { 19 login(username: string, password: string) {
18 this.authService.login(username, password).subscribe( 20 this.authService.login(username, password).subscribe(
19 result => { 21 result => {
22 this.error = null;
23
20 const user = new User(username, result); 24 const user = new User(username, result);
21 user.save(); 25 user.save();
22 26
@@ -26,9 +30,9 @@ export class LoginComponent {
26 }, 30 },
27 error => { 31 error => {
28 if (error.error === 'invalid_grant') { 32 if (error.error === 'invalid_grant') {
29 alert('Credentials are invalid.'); 33 this.error = 'Credentials are invalid.';
30 } else { 34 } else {
31 alert(`${error.error}: ${error.error_description}`); 35 this.error = `${error.error}: ${error.error_description}`;
32 } 36 }
33 } 37 }
34 ); 38 );