diff --git a/pkg/ui/src/redux/login.ts b/pkg/ui/src/redux/login.ts index baceaa47e44e..c77d26a052c6 100644 --- a/pkg/ui/src/redux/login.ts +++ b/pkg/ui/src/redux/login.ts @@ -130,17 +130,15 @@ function shouldRedirect(location: Location) { } export function getLoginPage(location: Location) { - const query = !shouldRedirect(location) + const redirectTo = !shouldRedirect(location) ? undefined - : { - redirectTo: createPath({ - pathname: location.pathname, - search: location.search, - }), - }; + : createPath({ + pathname: location.pathname, + search: location.search, + }); return { pathname: LOGIN_PAGE, - query: query, + search: `?redirectTo=${encodeURIComponent(redirectTo)}`, }; } diff --git a/pkg/ui/src/views/login/loginPage.tsx b/pkg/ui/src/views/login/loginPage.tsx index a4b14f380049..bc3f272b3d36 100644 --- a/pkg/ui/src/views/login/loginPage.tsx +++ b/pkg/ui/src/views/login/loginPage.tsx @@ -124,7 +124,7 @@ export class LoginPage extends React.Component { const { location, history } = this.props; const params = new URLSearchParams(location.search); if (params.has("redirectTo")) { - history.push(params.get("redirectTo")); + history.push(decodeURIComponent(params.get("redirectTo"))); } else { history.push("/"); }