diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-12-11 21:50:51 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-12-19 21:22:28 +0100 |
commit | feb4bdfd9b46e87aadfa7c0d5338cde887d1f58c (patch) | |
tree | 2abc9fbc9569760e218fd52835850b757344b420 /client/src/app/shared/auth | |
parent | 108626609eda75e4ecc0a83a650a4d53c46220e0 (diff) | |
download | PeerTube-feb4bdfd9b46e87aadfa7c0d5338cde887d1f58c.tar.gz PeerTube-feb4bdfd9b46e87aadfa7c0d5338cde887d1f58c.tar.zst PeerTube-feb4bdfd9b46e87aadfa7c0d5338cde887d1f58c.zip |
First version with PostgreSQL
Diffstat (limited to 'client/src/app/shared/auth')
-rw-r--r-- | client/src/app/shared/auth/auth-user.model.ts | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/client/src/app/shared/auth/auth-user.model.ts b/client/src/app/shared/auth/auth-user.model.ts index bdd5ea5a9..f560351f4 100644 --- a/client/src/app/shared/auth/auth-user.model.ts +++ b/client/src/app/shared/auth/auth-user.model.ts | |||
@@ -7,9 +7,6 @@ export class AuthUser extends User { | |||
7 | USERNAME: 'username' | 7 | USERNAME: 'username' |
8 | }; | 8 | }; |
9 | 9 | ||
10 | id: string; | ||
11 | role: string; | ||
12 | username: string; | ||
13 | tokens: Tokens; | 10 | tokens: Tokens; |
14 | 11 | ||
15 | static load() { | 12 | static load() { |
@@ -17,7 +14,7 @@ export class AuthUser extends User { | |||
17 | if (usernameLocalStorage) { | 14 | if (usernameLocalStorage) { |
18 | return new AuthUser( | 15 | return new AuthUser( |
19 | { | 16 | { |
20 | id: localStorage.getItem(this.KEYS.ID), | 17 | id: parseInt(localStorage.getItem(this.KEYS.ID)), |
21 | username: localStorage.getItem(this.KEYS.USERNAME), | 18 | username: localStorage.getItem(this.KEYS.USERNAME), |
22 | role: localStorage.getItem(this.KEYS.ROLE) | 19 | role: localStorage.getItem(this.KEYS.ROLE) |
23 | }, | 20 | }, |
@@ -35,7 +32,7 @@ export class AuthUser extends User { | |||
35 | Tokens.flush(); | 32 | Tokens.flush(); |
36 | } | 33 | } |
37 | 34 | ||
38 | constructor(userHash: { id: string, username: string, role: string }, hashTokens: any) { | 35 | constructor(userHash: { id: number, username: string, role: string }, hashTokens: any) { |
39 | super(userHash); | 36 | super(userHash); |
40 | this.tokens = new Tokens(hashTokens); | 37 | this.tokens = new Tokens(hashTokens); |
41 | } | 38 | } |
@@ -58,7 +55,7 @@ export class AuthUser extends User { | |||
58 | } | 55 | } |
59 | 56 | ||
60 | save() { | 57 | save() { |
61 | localStorage.setItem(AuthUser.KEYS.ID, this.id); | 58 | localStorage.setItem(AuthUser.KEYS.ID, this.id.toString()); |
62 | localStorage.setItem(AuthUser.KEYS.USERNAME, this.username); | 59 | localStorage.setItem(AuthUser.KEYS.USERNAME, this.username); |
63 | localStorage.setItem(AuthUser.KEYS.ROLE, this.role); | 60 | localStorage.setItem(AuthUser.KEYS.ROLE, this.role); |
64 | this.tokens.save(); | 61 | this.tokens.save(); |