aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/login/login.component.ts
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-06-04 13:31:23 +0200
committerChocobozzz <florian.bigard@gmail.com>2016-06-04 13:31:23 +0200
commit192ea60b82806669fd633888fe9641f24bd5abd3 (patch)
tree7f1ad827d69b747e4acdd4c44f0265fa3df97b66 /client/src/app/login/login.component.ts
parent7f82b8ae377214dd9b3f13a76a5e5f4e963e9425 (diff)
downloadPeerTube-192ea60b82806669fd633888fe9641f24bd5abd3.tar.gz
PeerTube-192ea60b82806669fd633888fe9641f24bd5abd3.tar.zst
PeerTube-192ea60b82806669fd633888fe9641f24bd5abd3.zip
Improve the login form
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 );