diff --git a/app/stores/AuthStore.ts b/app/stores/AuthStore.ts index 3afdd1f8ba..a3d6acc6bd 100644 --- a/app/stores/AuthStore.ts +++ b/app/stores/AuthStore.ts @@ -306,7 +306,7 @@ export default class AuthStore extends Store { // if this logout was forced from an authenticated route then // save the current path so we can go back there once signed in if (savePath) { - setPostLoginPath(window.location.pathname); + setPostLoginPath(window.location.pathname + window.location.search); } if (tryRevokingToken) { diff --git a/app/utils/urls.ts b/app/utils/urls.ts index c2eba8337b..197e00fa3f 100644 --- a/app/utils/urls.ts +++ b/app/utils/urls.ts @@ -49,8 +49,10 @@ export function redirectTo(url: string) { /** * Check if the path is a valid path for redirect after login. * - * @param path + * @param input A path potentially including query string * @returns boolean indicating if the path is a valid redirect */ -export const isAllowedLoginRedirect = (path: string) => - !["/", "/create", "/home", "/logout", "/auth/"].includes(path); +export const isAllowedLoginRedirect = (input: string) => { + const path = input.split("?")[0]; + return !["/", "/create", "/home", "/logout", "/auth/"].includes(path); +};