@rolatech/angular-auth
Advanced tools
@@ -336,8 +336,10 @@ import * as i0 from '@angular/core'; | ||
| const platformId = inject(PLATFORM_ID); | ||
| const isContinue = state.url.includes('continue'); | ||
| const continueUrl = route.queryParams['continue']; | ||
| // window = inject(WINDOW) | ||
| if (!isPlatformBrowser(platformId)) { | ||
| return of(false); | ||
| } | ||
| const isContinue = state.url.includes('continue'); | ||
| const continueUrl = route.queryParams['continue']; | ||
| const isSignInPage = state.url.includes('/signin'); | ||
| const currentOrigin = window.location.origin; | ||
| const shouldAttachContinue = currentOrigin !== environment.accountsUrl; // or compare to env.publicAppUrl origin if you have it | ||
| return authService.introspect().pipe(map$1(({ roles, authenticated }) => { | ||
@@ -351,17 +353,29 @@ const routeRoles = route.data['roles']; | ||
| if (authenticated) { | ||
| if (window.location.href.includes(environment.accountsUrl) && !isContinue) { | ||
| // window.location.href = `${environment.myaccountUrl}/${lang}`; | ||
| window.location.href = `${environment.myaccountUrl}`; | ||
| if (isSignInPage) { | ||
| window.location.href = continueUrl || environment.myaccountUrl; | ||
| return false; // Prevent rendering the Sign-in page | ||
| } | ||
| // 1. If 'continue' parameter exists, redirect to it immediately | ||
| if (isContinue) { | ||
| window.location.href = continueUrl; | ||
| } | ||
| // 2. If already at the accounts domain and NO continue URL, redirect to default account page | ||
| if (window.location.href.includes(environment.accountsUrl)) { | ||
| window.location.href = environment.myaccountUrl; | ||
| return false; | ||
| } | ||
| // 3. Otherwise, if the user is already where they need to be, allow navigation | ||
| return true; | ||
| } | ||
| else { | ||
| if (!isContinue) { | ||
| window.location.href = environment.accountsUrl + `/signin?continue=${window.location.href}`; | ||
| // CASE: Not logged in | ||
| if (isSignInPage) { | ||
| return true; // Allow guest to see the Sign-in page | ||
| } | ||
| return true; | ||
| // Redirection for UNAUTHENTICATED users | ||
| const currentUrl = encodeURIComponent(window.location.href); | ||
| console.log(currentUrl); | ||
| window.location.href = `${environment.accountsUrl}/signin?continue=${currentUrl}`; | ||
| return false; | ||
| } | ||
| return authenticated; | ||
| })); | ||
@@ -368,0 +382,0 @@ }; |
+4
-4
| { | ||
| "name": "@rolatech/angular-auth", | ||
| "version": "20.2.8-beta.10", | ||
| "version": "20.2.8-beta.11", | ||
| "private": false, | ||
@@ -10,5 +10,5 @@ "peerDependencies": { | ||
| "dependencies": { | ||
| "@rolatech/angular-common": "20.2.8-beta.10", | ||
| "@rolatech/angular-components": "20.2.8-beta.10", | ||
| "@rolatech/angular-services": "20.2.8-beta.10", | ||
| "@rolatech/angular-common": "20.2.8-beta.11", | ||
| "@rolatech/angular-components": "20.2.8-beta.11", | ||
| "@rolatech/angular-services": "20.2.8-beta.11", | ||
| "tslib": "^2.3.0" | ||
@@ -15,0 +15,0 @@ }, |
Sorry, the diff of this file is too big to display
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
136160
1.53%1121
1.26%+ Added
+ Added
+ Added
- Removed
- Removed
- Removed