fix: Post-auth subdomain redirect

This commit is contained in:
Tom Moor
2022-06-22 19:51:37 +02:00
parent 6d4da176d1
commit 51230a55e5
2 changed files with 8 additions and 6 deletions

View File

@@ -18,7 +18,13 @@ export default function createMiddleware(providerName: string) {
if (err.id) {
const notice = err.id.replace(/_/g, "-");
return ctx.redirect(`${err.redirectUrl || "/"}?notice=${notice}`);
const hasQueryString = err.redirectUrl?.includes("?");
return ctx.redirect(
`${err.redirectUrl || "/"}${
hasQueryString ? "&" : "?"
}notice=${notice}`
);
}
if (env.ENVIRONMENT === "development") {

View File

@@ -60,11 +60,7 @@ export class StateStore {
url.host = appDomain.host;
return callback(
AuthRedirectError(`redirect to: ${url.toString()}`, url.toString()),
false,
token
);
return callback(AuthRedirectError(``, url.toString()), false, token);
}
// Destroy the one-time pad token and ensure it matches