sejal-gupta-ksolves commented on code in PR #11868:
URL: https://github.com/apache/nifi/pull/11868#discussion_r4440096818


##########
nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/login/state/access/access.effects.ts:
##########
@@ -59,7 +61,13 @@ export class AccessEffects {
             this.actions$.pipe(
                 ofType(AccessActions.loginSuccess),
                 tap(() => {
-                    this.router.navigate(['/']);
+                    const returnUrl = this.storageService.getReturnUrl();

Review Comment:
   `loginSuccess$` is back to just `this.router.navigate(['/'])` (no diff 
against main for that file). The stored URL is now restored in a new 
`restoreReturnUrl$` effect on `loadCurrentUserSuccess`, so it covers both form 
and external login. It removes the key before calling `navigateByUrl`, so later 
polling successes are no-ops.
   



##########
nifi-frontend/src/main/frontend/apps/nifi/src/app/state/current-user/current-user.effects.ts:
##########
@@ -75,6 +77,10 @@ export class CurrentUserEffects {
             this.actions$.pipe(
                 ofType(UserActions.navigateToLogIn),
                 tap(() => {
+                    const currentUrl = window.location.hash.substring(1);
+                    if (currentUrl.startsWith('/') && !['/login', 
'/logout-complete'].includes(currentUrl)) {

Review Comment:
   Followed your suggestion: added `RETURN_URL`, `UNAUTHENTICATED_ROUTES` 
(`/login`, `/logout-complete`, `/error`, `/404`) and `isAuthenticatedRoute()` 
to `state/index.ts`. The check matches on the path only, so something like 
`/login?returnTo=/settings` is excluded, while an authenticated route such as 
`/settings?x=1` is stored with its query string. `navigateToLogIn$` keeps the 
`startsWith('/')` check and uses the shared predicate.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to