Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
open-webui
Commits
d3a67b44
Unverified
Commit
d3a67b44
authored
Jun 29, 2024
by
Timothy Jaeryang Baek
Committed by
GitHub
Jun 29, 2024
Browse files
Merge pull request #3499 from Semihal/fix-oauth-openid
fix: First OIDC account is not admin
parents
58398b6e
7d10daca
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
2 deletions
+7
-2
backend/main.py
backend/main.py
+7
-2
No files found.
backend/main.py
View file @
d3a67b44
...
...
@@ -1944,6 +1944,11 @@ async def oauth_callback(provider: str, request: Request, response: Response):
picture_url
=
""
if
not
picture_url
:
picture_url
=
"/user.png"
role
=
(
"admin"
if
Users
.
get_num_users
()
==
0
else
webui_app
.
state
.
config
.
DEFAULT_USER_ROLE
)
user
=
Auths
.
insert_new_auth
(
email
=
email
,
password
=
get_password_hash
(
...
...
@@ -1951,7 +1956,7 @@ async def oauth_callback(provider: str, request: Request, response: Response):
),
# Random password, not used
name
=
user_data
.
get
(
"name"
,
"User"
),
profile_image_url
=
picture_url
,
role
=
webui_app
.
state
.
config
.
DEFAULT_USER_ROLE
,
role
=
role
,
oauth_sub
=
provider_sub
,
)
...
...
@@ -1978,7 +1983,7 @@ async def oauth_callback(provider: str, request: Request, response: Response):
# Set the cookie token
response
.
set_cookie
(
key
=
"token"
,
value
=
token
,
value
=
jwt_
token
,
httponly
=
True
,
# Ensures the cookie is not accessible via JavaScript
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment