|
@@ -2064,7 +2064,8 @@ async def oauth_callback(provider: str, request: Request, response: Response):
|
|
|
if existing_user:
|
|
|
raise HTTPException(400, detail=ERROR_MESSAGES.EMAIL_TAKEN)
|
|
|
|
|
|
- picture_url = user_data.get("picture", "")
|
|
|
+ picture_claim = webui_app.state.config.OAUTH_PICTURE_CLAIM
|
|
|
+ picture_url = user_data.get(picture_claim, "")
|
|
|
if picture_url:
|
|
|
# Download the profile image into a base64 string
|
|
|
try:
|
|
@@ -2084,6 +2085,7 @@ async def oauth_callback(provider: str, request: Request, response: Response):
|
|
|
picture_url = ""
|
|
|
if not picture_url:
|
|
|
picture_url = "/user.png"
|
|
|
+ username_claim = webui_app.state.config.OAUTH_USERNAME_CLAIM
|
|
|
role = (
|
|
|
"admin"
|
|
|
if Users.get_num_users() == 0
|
|
@@ -2094,7 +2096,7 @@ async def oauth_callback(provider: str, request: Request, response: Response):
|
|
|
password=get_password_hash(
|
|
|
str(uuid.uuid4())
|
|
|
), # Random password, not used
|
|
|
- name=user_data.get("name", "User"),
|
|
|
+ name=user_data.get(username_claim, "User"),
|
|
|
profile_image_url=picture_url,
|
|
|
role=role,
|
|
|
oauth_sub=provider_sub,
|