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
12287f86
Commit
12287f86
authored
Mar 29, 2024
by
Timothy J. Baek
Browse files
chore: code formatting
parent
047c9fe8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
21 deletions
+26
-21
backend/apps/web/routers/auths.py
backend/apps/web/routers/auths.py
+26
-21
No files found.
backend/apps/web/routers/auths.py
View file @
12287f86
...
@@ -103,15 +103,20 @@ async def update_password(
...
@@ -103,15 +103,20 @@ async def update_password(
async
def
signin
(
request
:
Request
,
form_data
:
SigninForm
):
async
def
signin
(
request
:
Request
,
form_data
:
SigninForm
):
if
WEBUI_AUTH_TRUSTED_EMAIL_HEADER
:
if
WEBUI_AUTH_TRUSTED_EMAIL_HEADER
:
if
WEBUI_AUTH_TRUSTED_EMAIL_HEADER
not
in
request
.
headers
:
if
WEBUI_AUTH_TRUSTED_EMAIL_HEADER
not
in
request
.
headers
:
raise
HTTPException
(
400
,
raise
HTTPException
(
400
,
detail
=
ERROR_MESSAGES
.
INVALID_TRUSTED_HEADER
)
detail
=
ERROR_MESSAGES
.
INVALID_TRUSTED_HEADER
)
trusted_email
=
request
.
headers
[
WEBUI_AUTH_TRUSTED_EMAIL_HEADER
].
lower
()
trusted_email
=
request
.
headers
[
WEBUI_AUTH_TRUSTED_EMAIL_HEADER
].
lower
()
if
not
Users
.
get_user_by_email
(
trusted_email
.
lower
()):
if
not
Users
.
get_user_by_email
(
trusted_email
.
lower
()):
await
signup
(
request
,
SignupForm
(
email
=
trusted_email
,
password
=
str
(
uuid
.
uuid4
()),
name
=
trusted_email
))
await
signup
(
request
,
SignupForm
(
email
=
trusted_email
,
password
=
str
(
uuid
.
uuid4
()),
name
=
trusted_email
),
)
user
=
Auths
.
authenticate_user_by_trusted_header
(
trusted_email
)
user
=
Auths
.
authenticate_user_by_trusted_header
(
trusted_email
)
else
:
else
:
user
=
Auths
.
authenticate_user
(
form_data
.
email
.
lower
(),
user
=
Auths
.
authenticate_user
(
form_data
.
email
.
lower
(),
form_data
.
password
)
form_data
.
password
)
if
user
:
if
user
:
token
=
create_token
(
token
=
create_token
(
data
=
{
"id"
:
user
.
id
},
data
=
{
"id"
:
user
.
id
},
...
...
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