mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-12 04:15:25 +00:00
enh: ENABLE_OAUTH_EMAIL_FALLBACK
This commit is contained in:
parent
c453d919b3
commit
eaf786c1ef
2 changed files with 6 additions and 2 deletions
|
|
@ -468,7 +468,9 @@ ENABLE_COMPRESSION_MIDDLEWARE = (
|
||||||
####################################
|
####################################
|
||||||
# OAUTH Configuration
|
# OAUTH Configuration
|
||||||
####################################
|
####################################
|
||||||
|
ENABLE_OAUTH_EMAIL_FALLBACK = (
|
||||||
|
os.environ.get("ENABLE_OAUTH_EMAIL_FALLBACK", "False").lower() == "true"
|
||||||
|
)
|
||||||
|
|
||||||
ENABLE_OAUTH_ID_TOKEN_COOKIE = (
|
ENABLE_OAUTH_ID_TOKEN_COOKIE = (
|
||||||
os.environ.get("ENABLE_OAUTH_ID_TOKEN_COOKIE", "True").lower() == "true"
|
os.environ.get("ENABLE_OAUTH_ID_TOKEN_COOKIE", "True").lower() == "true"
|
||||||
|
|
@ -482,7 +484,6 @@ OAUTH_SESSION_TOKEN_ENCRYPTION_KEY = os.environ.get(
|
||||||
"OAUTH_SESSION_TOKEN_ENCRYPTION_KEY", WEBUI_SECRET_KEY
|
"OAUTH_SESSION_TOKEN_ENCRYPTION_KEY", WEBUI_SECRET_KEY
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
####################################
|
####################################
|
||||||
# SCIM Configuration
|
# SCIM Configuration
|
||||||
####################################
|
####################################
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,7 @@ from open_webui.env import (
|
||||||
WEBUI_AUTH_COOKIE_SAME_SITE,
|
WEBUI_AUTH_COOKIE_SAME_SITE,
|
||||||
WEBUI_AUTH_COOKIE_SECURE,
|
WEBUI_AUTH_COOKIE_SECURE,
|
||||||
ENABLE_OAUTH_ID_TOKEN_COOKIE,
|
ENABLE_OAUTH_ID_TOKEN_COOKIE,
|
||||||
|
ENABLE_OAUTH_EMAIL_FALLBACK,
|
||||||
OAUTH_CLIENT_INFO_ENCRYPTION_KEY,
|
OAUTH_CLIENT_INFO_ENCRYPTION_KEY,
|
||||||
)
|
)
|
||||||
from open_webui.utils.misc import parse_duration
|
from open_webui.utils.misc import parse_duration
|
||||||
|
|
@ -1153,6 +1154,8 @@ class OAuthManager:
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log.warning(f"Error fetching GitHub email: {e}")
|
log.warning(f"Error fetching GitHub email: {e}")
|
||||||
raise HTTPException(400, detail=ERROR_MESSAGES.INVALID_CRED)
|
raise HTTPException(400, detail=ERROR_MESSAGES.INVALID_CRED)
|
||||||
|
elif ENABLE_OAUTH_EMAIL_FALLBACK:
|
||||||
|
email = f"{provider_sub}.local"
|
||||||
else:
|
else:
|
||||||
log.warning(f"OAuth callback failed, email is missing: {user_data}")
|
log.warning(f"OAuth callback failed, email is missing: {user_data}")
|
||||||
raise HTTPException(400, detail=ERROR_MESSAGES.INVALID_CRED)
|
raise HTTPException(400, detail=ERROR_MESSAGES.INVALID_CRED)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue