diff options
Diffstat (limited to 'client/src/app/core/auth')
-rw-r--r-- | client/src/app/core/auth/auth-user.model.ts | 18 | ||||
-rw-r--r-- | client/src/app/core/auth/auth.service.ts | 4 |
2 files changed, 11 insertions, 11 deletions
diff --git a/client/src/app/core/auth/auth-user.model.ts b/client/src/app/core/auth/auth-user.model.ts index cd9665e37..a12325421 100644 --- a/client/src/app/core/auth/auth-user.model.ts +++ b/client/src/app/core/auth/auth-user.model.ts | |||
@@ -1,7 +1,7 @@ | |||
1 | import { Observable, of } from 'rxjs' | 1 | import { Observable, of } from 'rxjs' |
2 | import { map } from 'rxjs/operators' | 2 | import { map } from 'rxjs/operators' |
3 | import { User } from '@app/core/users/user.model' | 3 | import { User } from '@app/core/users/user.model' |
4 | import { UserTokens } from '@root-helpers/users' | 4 | import { OAuthUserTokens } from '@root-helpers/users' |
5 | import { hasUserRight } from '@shared/core-utils/users' | 5 | import { hasUserRight } from '@shared/core-utils/users' |
6 | import { | 6 | import { |
7 | MyUser as ServerMyUserModel, | 7 | MyUser as ServerMyUserModel, |
@@ -13,33 +13,33 @@ import { | |||
13 | } from '@shared/models' | 13 | } from '@shared/models' |
14 | 14 | ||
15 | export class AuthUser extends User implements ServerMyUserModel { | 15 | export class AuthUser extends User implements ServerMyUserModel { |
16 | tokens: UserTokens | 16 | oauthTokens: OAuthUserTokens |
17 | specialPlaylists: MyUserSpecialPlaylist[] | 17 | specialPlaylists: MyUserSpecialPlaylist[] |
18 | 18 | ||
19 | canSeeVideosLink = true | 19 | canSeeVideosLink = true |
20 | 20 | ||
21 | constructor (userHash: Partial<ServerMyUserModel>, hashTokens: Partial<UserTokens>) { | 21 | constructor (userHash: Partial<ServerMyUserModel>, hashTokens: Partial<OAuthUserTokens>) { |
22 | super(userHash) | 22 | super(userHash) |
23 | 23 | ||
24 | this.tokens = new UserTokens(hashTokens) | 24 | this.oauthTokens = new OAuthUserTokens(hashTokens) |
25 | this.specialPlaylists = userHash.specialPlaylists | 25 | this.specialPlaylists = userHash.specialPlaylists |
26 | } | 26 | } |
27 | 27 | ||
28 | getAccessToken () { | 28 | getAccessToken () { |
29 | return this.tokens.accessToken | 29 | return this.oauthTokens.accessToken |
30 | } | 30 | } |
31 | 31 | ||
32 | getRefreshToken () { | 32 | getRefreshToken () { |
33 | return this.tokens.refreshToken | 33 | return this.oauthTokens.refreshToken |
34 | } | 34 | } |
35 | 35 | ||
36 | getTokenType () { | 36 | getTokenType () { |
37 | return this.tokens.tokenType | 37 | return this.oauthTokens.tokenType |
38 | } | 38 | } |
39 | 39 | ||
40 | refreshTokens (accessToken: string, refreshToken: string) { | 40 | refreshTokens (accessToken: string, refreshToken: string) { |
41 | this.tokens.accessToken = accessToken | 41 | this.oauthTokens.accessToken = accessToken |
42 | this.tokens.refreshToken = refreshToken | 42 | this.oauthTokens.refreshToken = refreshToken |
43 | } | 43 | } |
44 | 44 | ||
45 | hasRight (right: UserRight) { | 45 | hasRight (right: UserRight) { |
diff --git a/client/src/app/core/auth/auth.service.ts b/client/src/app/core/auth/auth.service.ts index 7f4fae4aa..4de28e51e 100644 --- a/client/src/app/core/auth/auth.service.ts +++ b/client/src/app/core/auth/auth.service.ts | |||
@@ -5,7 +5,7 @@ import { HttpClient, HttpErrorResponse, HttpHeaders, HttpParams } from '@angular | |||
5 | import { Injectable } from '@angular/core' | 5 | import { Injectable } from '@angular/core' |
6 | import { Router } from '@angular/router' | 6 | import { Router } from '@angular/router' |
7 | import { Notifier } from '@app/core/notification/notifier.service' | 7 | import { Notifier } from '@app/core/notification/notifier.service' |
8 | import { logger, objectToUrlEncoded, peertubeLocalStorage, UserTokens } from '@root-helpers/index' | 8 | import { logger, OAuthUserTokens, objectToUrlEncoded, peertubeLocalStorage } from '@root-helpers/index' |
9 | import { HttpStatusCode, MyUser as UserServerModel, OAuthClientLocal, User, UserLogin, UserRefreshToken } from '@shared/models' | 9 | import { HttpStatusCode, MyUser as UserServerModel, OAuthClientLocal, User, UserLogin, UserRefreshToken } from '@shared/models' |
10 | import { environment } from '../../../environments/environment' | 10 | import { environment } from '../../../environments/environment' |
11 | import { RestExtractor } from '../rest/rest-extractor.service' | 11 | import { RestExtractor } from '../rest/rest-extractor.service' |
@@ -74,7 +74,7 @@ export class AuthService { | |||
74 | ] | 74 | ] |
75 | } | 75 | } |
76 | 76 | ||
77 | buildAuthUser (userInfo: Partial<User>, tokens: UserTokens) { | 77 | buildAuthUser (userInfo: Partial<User>, tokens: OAuthUserTokens) { |
78 | this.user = new AuthUser(userInfo, tokens) | 78 | this.user = new AuthUser(userInfo, tokens) |
79 | } | 79 | } |
80 | 80 | ||