diff options
author | Chocobozzz <me@florianbigard.com> | 2023-02-14 11:47:01 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2023-02-14 11:51:44 +0100 |
commit | 98bd5e2256bfdeba6d5ab07f0421acfde1a0de26 (patch) | |
tree | a1193f1af10f0da7a532d4aa6d5045e51c3d16a9 /client/src/app/core/routing/redirect.service.ts | |
parent | 4ea827076df39935375d66fffb5e1e27e667111e (diff) | |
download | PeerTube-98bd5e2256bfdeba6d5ab07f0421acfde1a0de26.tar.gz PeerTube-98bd5e2256bfdeba6d5ab07f0421acfde1a0de26.tar.zst PeerTube-98bd5e2256bfdeba6d5ab07f0421acfde1a0de26.zip |
Refactor login redirection/button links
Correctly handle external auth redirection in all cases
Diffstat (limited to 'client/src/app/core/routing/redirect.service.ts')
-rw-r--r-- | client/src/app/core/routing/redirect.service.ts | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/client/src/app/core/routing/redirect.service.ts b/client/src/app/core/routing/redirect.service.ts index 1344458d5..e239c6210 100644 --- a/client/src/app/core/routing/redirect.service.ts +++ b/client/src/app/core/routing/redirect.service.ts | |||
@@ -4,6 +4,8 @@ import { NavigationCancel, NavigationEnd, Router } from '@angular/router' | |||
4 | import { logger } from '@root-helpers/logger' | 4 | import { logger } from '@root-helpers/logger' |
5 | import { ServerService } from '../server' | 5 | import { ServerService } from '../server' |
6 | import { SessionStorageService } from '../wrappers/storage.service' | 6 | import { SessionStorageService } from '../wrappers/storage.service' |
7 | import { PluginsManager } from '@root-helpers/plugins-manager' | ||
8 | import { environment } from 'src/environments/environment' | ||
7 | 9 | ||
8 | const debugLogger = debug('peertube:router:RedirectService') | 10 | const debugLogger = debug('peertube:router:RedirectService') |
9 | 11 | ||
@@ -100,6 +102,13 @@ export class RedirectService { | |||
100 | 102 | ||
101 | } | 103 | } |
102 | 104 | ||
105 | redirectToLogin () { | ||
106 | const externalLoginUrl = PluginsManager.getDefaultLoginHref(environment.apiUrl, this.serverService.getHTMLConfig()) | ||
107 | |||
108 | if (externalLoginUrl) window.location.href = externalLoginUrl | ||
109 | else this.router.navigate([ '/login' ]) | ||
110 | } | ||
111 | |||
103 | private doRedirect (redirectUrl: string, fallbackRoute?: string) { | 112 | private doRedirect (redirectUrl: string, fallbackRoute?: string) { |
104 | debugLogger('Redirecting on %s', redirectUrl) | 113 | debugLogger('Redirecting on %s', redirectUrl) |
105 | 114 | ||