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
57c33057
Commit
57c33057
authored
Jun 28, 2024
by
Sergey Mihaylin
Browse files
Fix: admin role for OIDC signup for first user
parent
24b638fc
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
1 deletion
+6
-1
backend/main.py
backend/main.py
+6
-1
No files found.
backend/main.py
View file @
57c33057
...
@@ -1944,6 +1944,11 @@ async def oauth_callback(provider: str, request: Request, response: Response):
...
@@ -1944,6 +1944,11 @@ async def oauth_callback(provider: str, request: Request, response: Response):
picture_url
=
""
picture_url
=
""
if
not
picture_url
:
if
not
picture_url
:
picture_url
=
"/user.png"
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
(
user
=
Auths
.
insert_new_auth
(
email
=
email
,
email
=
email
,
password
=
get_password_hash
(
password
=
get_password_hash
(
...
@@ -1951,7 +1956,7 @@ async def oauth_callback(provider: str, request: Request, response: Response):
...
@@ -1951,7 +1956,7 @@ async def oauth_callback(provider: str, request: Request, response: Response):
),
# Random password, not used
),
# Random password, not used
name
=
user_data
.
get
(
"name"
,
"User"
),
name
=
user_data
.
get
(
"name"
,
"User"
),
profile_image_url
=
picture_url
,
profile_image_url
=
picture_url
,
role
=
webui_app
.
state
.
config
.
DEFAULT_USER_ROLE
,
role
=
role
,
oauth_sub
=
provider_sub
,
oauth_sub
=
provider_sub
,
)
)
...
...
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