diff --git a/server/routers/badger/verifySession.ts b/server/routers/badger/verifySession.ts index c369aef4..459219c5 100644 --- a/server/routers/badger/verifySession.ts +++ b/server/routers/badger/verifySession.ts @@ -101,8 +101,7 @@ export async function verifyResourceSession( return allowed(res); } - // const redirectUrl = `${config.getRawConfig().app.dashboard_url}/auth/resource/${encodeURIComponent(resource.resourceId)}?redirect=${encodeURIComponent(originalRequestURL)}`; - const redirectUrl = `${config.getRawConfig().app.dashboard_url}/auth/resource/${encodeURIComponent(resource.resourceId)}`; + const redirectUrl = `${config.getRawConfig().app.dashboard_url}/auth/resource/${encodeURIComponent(resource.resourceId)}?redirect=${encodeURIComponent(originalRequestURL)}`; if (!sessions) { return notAllowed(res); diff --git a/src/app/auth/resource/[resourceId]/page.tsx b/src/app/auth/resource/[resourceId]/page.tsx index 4258f688..2cf37848 100644 --- a/src/app/auth/resource/[resourceId]/page.tsx +++ b/src/app/auth/resource/[resourceId]/page.tsx @@ -56,16 +56,16 @@ export default async function ResourceAuthPage(props: { } let redirectUrl = authInfo.url; - // if (searchParams.redirect) { - // try { - // const serverResourceHost = new URL(authInfo.url).host; - // const redirectHost = new URL(searchParams.redirect).host; - // - // if (serverResourceHost === redirectHost) { - // redirectUrl = searchParams.redirect; - // } - // } catch (e) {} - // } + if (searchParams.redirect) { + try { + const serverResourceHost = new URL(authInfo.url).host; + const redirectHost = new URL(searchParams.redirect).host; + + if (serverResourceHost === redirectHost) { + redirectUrl = searchParams.redirect; + } + } catch (e) {} + } const hasAuth = authInfo.password ||