aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/core
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-05-09 10:47:46 +0200
committerChocobozzz <me@florianbigard.com>2022-05-09 10:47:46 +0200
commitcb28bb92daf1a0e123bc0144030c2bc65b865f4a (patch)
treed8834a76b1e9a02316efc194b32d490db32daf24 /client/src/app/core
parentf82ea670d83dd7a02843b5ccc36ab1ce180a8d44 (diff)
downloadPeerTube-cb28bb92daf1a0e123bc0144030c2bc65b865f4a.tar.gz
PeerTube-cb28bb92daf1a0e123bc0144030c2bc65b865f4a.tar.zst
PeerTube-cb28bb92daf1a0e123bc0144030c2bc65b865f4a.zip
Add URL redirection support for external auth
Diffstat (limited to 'client/src/app/core')
-rw-r--r--client/src/app/core/routing/redirect.service.ts10
1 files changed, 7 insertions, 3 deletions
diff --git a/client/src/app/core/routing/redirect.service.ts b/client/src/app/core/routing/redirect.service.ts
index 571476d1d..d4cb0436e 100644
--- a/client/src/app/core/routing/redirect.service.ts
+++ b/client/src/app/core/routing/redirect.service.ts
@@ -46,19 +46,23 @@ export class RedirectService {
46 return this.defaultTrendingAlgorithm 46 return this.defaultTrendingAlgorithm
47 } 47 }
48 48
49 redirectToPreviousRoute (fallbackRoute: string[] = null) { 49 getPreviousUrl () {
50 return this.previousUrl
51 }
52
53 redirectToPreviousRoute (fallbackRoute?: string) {
50 const exceptions = [ 54 const exceptions = [
51 '/verify-account', 55 '/verify-account',
52 '/reset-password' 56 '/reset-password'
53 ] 57 ]
54 58
55 if (this.previousUrl) { 59 if (this.previousUrl && this.previousUrl !== '/') {
56 const isException = exceptions.find(e => this.previousUrl.startsWith(e)) 60 const isException = exceptions.find(e => this.previousUrl.startsWith(e))
57 if (!isException) return this.router.navigateByUrl(this.previousUrl) 61 if (!isException) return this.router.navigateByUrl(this.previousUrl)
58 } 62 }
59 63
60 if (fallbackRoute) { 64 if (fallbackRoute) {
61 return this.router.navigate(fallbackRoute) 65 return this.router.navigateByUrl(fallbackRoute)
62 } 66 }
63 67
64 return this.redirectToHomepage() 68 return this.redirectToHomepage()