mirror of
https://github.com/open-webui/open-webui
synced 2025-06-09 07:56:42 +00:00
Environment variable to redirect on logout
This commit is contained in:
parent
63533c9e3a
commit
b4465987f9
@ -340,6 +340,9 @@ BYPASS_MODEL_ACCESS_CONTROL = (
|
||||
os.environ.get("BYPASS_MODEL_ACCESS_CONTROL", "False").lower() == "true"
|
||||
)
|
||||
|
||||
SIGNOUT_REDIRECT_URI = os.environ.get("SIGNOUT_REDIRECT_URI", None)
|
||||
|
||||
|
||||
####################################
|
||||
# WEBUI_SECRET_KEY
|
||||
####################################
|
||||
|
@ -335,6 +335,7 @@ from open_webui.env import (
|
||||
WEBUI_SESSION_COOKIE_SECURE,
|
||||
WEBUI_AUTH_TRUSTED_EMAIL_HEADER,
|
||||
WEBUI_AUTH_TRUSTED_NAME_HEADER,
|
||||
SIGNOUT_REDIRECT_URI,
|
||||
ENABLE_WEBSOCKET_SUPPORT,
|
||||
BYPASS_MODEL_ACCESS_CONTROL,
|
||||
RESET_CONFIG_ON_START,
|
||||
@ -564,6 +565,7 @@ app.state.config.LDAP_CIPHERS = LDAP_CIPHERS
|
||||
|
||||
app.state.AUTH_TRUSTED_EMAIL_HEADER = WEBUI_AUTH_TRUSTED_EMAIL_HEADER
|
||||
app.state.AUTH_TRUSTED_NAME_HEADER = WEBUI_AUTH_TRUSTED_NAME_HEADER
|
||||
app.state.SIGNOUT_REDIRECT_URI = SIGNOUT_REDIRECT_URI
|
||||
|
||||
app.state.USER_COUNT = None
|
||||
app.state.TOOLS = {}
|
||||
|
@ -27,6 +27,7 @@ from open_webui.env import (
|
||||
WEBUI_AUTH_TRUSTED_NAME_HEADER,
|
||||
WEBUI_AUTH_COOKIE_SAME_SITE,
|
||||
WEBUI_AUTH_COOKIE_SECURE,
|
||||
SIGNOUT_REDIRECT_URI,
|
||||
SRC_LOG_LEVELS,
|
||||
)
|
||||
from fastapi import APIRouter, Depends, HTTPException, Request, status
|
||||
@ -555,6 +556,12 @@ async def signout(request: Request, response: Response):
|
||||
detail="Failed to sign out from the OpenID provider.",
|
||||
)
|
||||
|
||||
if SIGNOUT_REDIRECT_URI:
|
||||
return RedirectResponse(
|
||||
headers=response.headers,
|
||||
url=SIGNOUT_REDIRECT_URI,
|
||||
)
|
||||
|
||||
return {"status": True}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user