diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-06-01 20:36:27 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-06-01 20:36:27 +0200 |
commit | a840d396093ef968f9512862197ac166a1ff9921 (patch) | |
tree | f7e4c93ee3ae8a44bd14fd1f7c74234eef7469ef /client/app/users/login | |
parent | 575fdcece562b914149f89f5a5b96ab206648f09 (diff) | |
download | PeerTube-a840d396093ef968f9512862197ac166a1ff9921.tar.gz PeerTube-a840d396093ef968f9512862197ac166a1ff9921.tar.zst PeerTube-a840d396093ef968f9512862197ac166a1ff9921.zip |
Add authentication tokens to make friends/quit friends
Diffstat (limited to 'client/app/users/login')
-rw-r--r-- | client/app/users/login/index.ts | 1 | ||||
-rw-r--r-- | client/app/users/login/login.component.html | 14 | ||||
-rw-r--r-- | client/app/users/login/login.component.scss | 0 | ||||
-rw-r--r-- | client/app/users/login/login.component.ts | 37 |
4 files changed, 0 insertions, 52 deletions
diff --git a/client/app/users/login/index.ts b/client/app/users/login/index.ts deleted file mode 100644 index 69c16441f..000000000 --- a/client/app/users/login/index.ts +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | export * from './login.component'; | ||
diff --git a/client/app/users/login/login.component.html b/client/app/users/login/login.component.html deleted file mode 100644 index 940694515..000000000 --- a/client/app/users/login/login.component.html +++ /dev/null | |||
@@ -1,14 +0,0 @@ | |||
1 | <h3>Login</h3> | ||
2 | <form role="form" (submit)="login(username.value, password.value)"> | ||
3 | <div class="form-group"> | ||
4 | <label for="username">Username</label> | ||
5 | <input type="text" #username class="form-control" id="username" placeholder="Username"> | ||
6 | </div> | ||
7 | |||
8 | <div class="form-group"> | ||
9 | <label for="password">Password</label> | ||
10 | <input type="password" #password class="form-control" id="password" placeholder="Password"> | ||
11 | </div> | ||
12 | |||
13 | <input type="submit" value="Login" class="btn btn-default"> | ||
14 | </form> | ||
diff --git a/client/app/users/login/login.component.scss b/client/app/users/login/login.component.scss deleted file mode 100644 index e69de29bb..000000000 --- a/client/app/users/login/login.component.scss +++ /dev/null | |||
diff --git a/client/app/users/login/login.component.ts b/client/app/users/login/login.component.ts deleted file mode 100644 index 09c5f1af7..000000000 --- a/client/app/users/login/login.component.ts +++ /dev/null | |||
@@ -1,37 +0,0 @@ | |||
1 | import { Component } from '@angular/core'; | ||
2 | import { Router } from '@angular/router-deprecated'; | ||
3 | |||
4 | import { AuthService, AuthStatus, User } from '../shared/index'; | ||
5 | |||
6 | @Component({ | ||
7 | selector: 'my-user-login', | ||
8 | styleUrls: [ 'client/app/users/login/login.component.css' ], | ||
9 | templateUrl: 'client/app/users/login/login.component.html' | ||
10 | }) | ||
11 | |||
12 | export class UserLoginComponent { | ||
13 | constructor( | ||
14 | private authService: AuthService, | ||
15 | private router: Router | ||
16 | ) {} | ||
17 | |||
18 | login(username: string, password: string) { | ||
19 | this.authService.login(username, password).subscribe( | ||
20 | result => { | ||
21 | const user = new User(username, result); | ||
22 | user.save(); | ||
23 | |||
24 | this.authService.setStatus(AuthStatus.LoggedIn); | ||
25 | |||
26 | this.router.navigate(['VideosList']); | ||
27 | }, | ||
28 | error => { | ||
29 | if (error.error === 'invalid_grant') { | ||
30 | alert('Credentials are invalid.'); | ||
31 | } else { | ||
32 | alert(`${error.error}: ${error.error_description}`); | ||
33 | } | ||
34 | } | ||
35 | ); | ||
36 | } | ||
37 | } | ||