diff options
Diffstat (limited to 'client/src/app/core/auth')
-rw-r--r-- | client/src/app/core/auth/auth-user.model.ts | 3 | ||||
-rw-r--r-- | client/src/app/core/auth/auth.service.ts | 3 |
2 files changed, 5 insertions, 1 deletions
diff --git a/client/src/app/core/auth/auth-user.model.ts b/client/src/app/core/auth/auth-user.model.ts index 7115b9781..f827bd6ca 100644 --- a/client/src/app/core/auth/auth-user.model.ts +++ b/client/src/app/core/auth/auth-user.model.ts | |||
@@ -5,6 +5,7 @@ export class AuthUser extends User { | |||
5 | private static KEYS = { | 5 | private static KEYS = { |
6 | ID: 'id', | 6 | ID: 'id', |
7 | ROLE: 'role', | 7 | ROLE: 'role', |
8 | EMAIL: 'email', | ||
8 | USERNAME: 'username', | 9 | USERNAME: 'username', |
9 | DISPLAY_NSFW: 'display_nsfw' | 10 | DISPLAY_NSFW: 'display_nsfw' |
10 | }; | 11 | }; |
@@ -18,6 +19,7 @@ export class AuthUser extends User { | |||
18 | { | 19 | { |
19 | id: parseInt(localStorage.getItem(this.KEYS.ID)), | 20 | id: parseInt(localStorage.getItem(this.KEYS.ID)), |
20 | username: localStorage.getItem(this.KEYS.USERNAME), | 21 | username: localStorage.getItem(this.KEYS.USERNAME), |
22 | email: localStorage.getItem(this.KEYS.EMAIL), | ||
21 | role: localStorage.getItem(this.KEYS.ROLE), | 23 | role: localStorage.getItem(this.KEYS.ROLE), |
22 | displayNSFW: localStorage.getItem(this.KEYS.DISPLAY_NSFW) === 'true' | 24 | displayNSFW: localStorage.getItem(this.KEYS.DISPLAY_NSFW) === 'true' |
23 | }, | 25 | }, |
@@ -40,6 +42,7 @@ export class AuthUser extends User { | |||
40 | id: number, | 42 | id: number, |
41 | username: string, | 43 | username: string, |
42 | role: string, | 44 | role: string, |
45 | email: string, | ||
43 | displayNSFW: boolean | 46 | displayNSFW: boolean |
44 | }, hashTokens: any) { | 47 | }, hashTokens: any) { |
45 | super(userHash); | 48 | super(userHash); |
diff --git a/client/src/app/core/auth/auth.service.ts b/client/src/app/core/auth/auth.service.ts index 00a4216ef..caf765b42 100644 --- a/client/src/app/core/auth/auth.service.ts +++ b/client/src/app/core/auth/auth.service.ts | |||
@@ -218,6 +218,7 @@ export class AuthService { | |||
218 | const id = obj.id; | 218 | const id = obj.id; |
219 | const username = obj.username; | 219 | const username = obj.username; |
220 | const role = obj.role; | 220 | const role = obj.role; |
221 | const email = obj.email; | ||
221 | const displayNSFW = obj.displayNSFW; | 222 | const displayNSFW = obj.displayNSFW; |
222 | const hashTokens = { | 223 | const hashTokens = { |
223 | access_token: obj.access_token, | 224 | access_token: obj.access_token, |
@@ -225,7 +226,7 @@ export class AuthService { | |||
225 | refresh_token: obj.refresh_token | 226 | refresh_token: obj.refresh_token |
226 | }; | 227 | }; |
227 | 228 | ||
228 | this.user = new AuthUser({ id, username, role, displayNSFW }, hashTokens); | 229 | this.user = new AuthUser({ id, username, role, displayNSFW, email }, hashTokens); |
229 | this.user.save(); | 230 | this.user.save(); |
230 | 231 | ||
231 | this.setStatus(AuthStatus.LoggedIn); | 232 | this.setStatus(AuthStatus.LoggedIn); |