mirror of
https://github.com/open-webui/open-webui
synced 2025-04-26 09:10:15 +00:00
Merge pull request #8493 from kyunwang/fix/oidc-500-error-name-field
fix: Check OAuth name type with fallback
This commit is contained in:
commit
be665f2a3e
@ -276,8 +276,13 @@ class OAuthManager:
|
|||||||
picture_url = ""
|
picture_url = ""
|
||||||
if not picture_url:
|
if not picture_url:
|
||||||
picture_url = "/user.png"
|
picture_url = "/user.png"
|
||||||
|
|
||||||
username_claim = auth_manager_config.OAUTH_USERNAME_CLAIM
|
username_claim = auth_manager_config.OAUTH_USERNAME_CLAIM
|
||||||
|
|
||||||
|
name = user_data.get(username_claim)
|
||||||
|
if not isinstance(user, str):
|
||||||
|
name = email
|
||||||
|
|
||||||
role = self.get_user_role(None, user_data)
|
role = self.get_user_role(None, user_data)
|
||||||
|
|
||||||
user = Auths.insert_new_auth(
|
user = Auths.insert_new_auth(
|
||||||
@ -285,7 +290,7 @@ class OAuthManager:
|
|||||||
password=get_password_hash(
|
password=get_password_hash(
|
||||||
str(uuid.uuid4())
|
str(uuid.uuid4())
|
||||||
), # Random password, not used
|
), # Random password, not used
|
||||||
name=user_data.get(username_claim, "User"),
|
name=name,
|
||||||
profile_image_url=picture_url,
|
profile_image_url=picture_url,
|
||||||
role=role,
|
role=role,
|
||||||
oauth_sub=provider_sub,
|
oauth_sub=provider_sub,
|
||||||
|
Loading…
Reference in New Issue
Block a user