mirror of
https://github.com/open-webui/open-webui
synced 2025-01-19 01:06:45 +00:00
Check OAuth name type with fallback
This commit is contained in:
parent
21abe43f3b
commit
1ad9be9c07
@ -277,8 +277,13 @@ class OAuthManager:
|
||||
picture_url = ""
|
||||
if not picture_url:
|
||||
picture_url = "/user.png"
|
||||
|
||||
username_claim = auth_manager_config.OAUTH_USERNAME_CLAIM
|
||||
|
||||
username = user_data.get(username_claim)
|
||||
if not isinstance(username, str):
|
||||
username = "User"
|
||||
|
||||
role = self.get_user_role(None, user_data)
|
||||
|
||||
user = Auths.insert_new_auth(
|
||||
@ -286,7 +291,7 @@ class OAuthManager:
|
||||
password=get_password_hash(
|
||||
str(uuid.uuid4())
|
||||
), # Random password, not used
|
||||
name=user_data.get(username_claim, "User"),
|
||||
name=username,
|
||||
profile_image_url=picture_url,
|
||||
role=role,
|
||||
oauth_sub=provider_sub,
|
||||
|
Loading…
Reference in New Issue
Block a user