feat(ui): allow direct logout redirects to safe return urls instead of forcing login page
This commit is contained in:
parent
8babb8a46e
commit
561588624a
@ -1129,6 +1129,7 @@ app.get("/api/forward-auth", async (c) => {
|
||||
// If a browser is requesting a webpage on an unregistered domain, seamlessly redirect to unregistered error view
|
||||
if (accept.includes("text/html")) {
|
||||
const loginDomain = rpID || "auth.atyg.org";
|
||||
c.header("Cache-Control", "no-store, no-cache, must-revalidate, max-age=0");
|
||||
return c.redirect(
|
||||
`https://${loginDomain}/errors/unregistered?host=${
|
||||
encodeURIComponent(host)
|
||||
@ -1191,6 +1192,7 @@ app.get("/api/forward-auth", async (c) => {
|
||||
// If a browser is requesting a webpage, seamlessly redirect to login
|
||||
if (accept.includes("text/html")) {
|
||||
const loginDomain = rpID || "auth.atyg.org";
|
||||
c.header("Cache-Control", "no-store, no-cache, must-revalidate, max-age=0");
|
||||
return c.redirect(
|
||||
`https://${loginDomain}/login?redirect=${
|
||||
encodeURIComponent(originalUrl)
|
||||
|
||||
@ -98,7 +98,8 @@ uiApp.get("/logout", async (c) => {
|
||||
});
|
||||
|
||||
if (safeRedirect) {
|
||||
return c.redirect(`/login?redirect=${encodeURIComponent(safeRedirect)}`);
|
||||
c.header("Cache-Control", "no-store, no-cache, must-revalidate, max-age=0");
|
||||
return c.redirect(safeRedirect);
|
||||
}
|
||||
c.header("Cache-Control", "no-store, no-cache, must-revalidate, max-age=0");
|
||||
return c.redirect("/login");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user