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
500f61b7
"git@developer.sourcefind.cn:gaoqiong/migraphx.git" did not exist on "e314f8fbf575be9dcd40dd0aab8302c11ecb03bb"
Commit
500f61b7
authored
Dec 29, 2023
by
Timothy J. Baek
Browse files
chore: update password refac
parent
d8bb19fd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
13 deletions
+5
-13
backend/apps/web/models/auths.py
backend/apps/web/models/auths.py
+4
-12
backend/apps/web/routers/auths.py
backend/apps/web/routers/auths.py
+1
-1
No files found.
backend/apps/web/models/auths.py
View file @
500f61b7
...
...
@@ -114,19 +114,11 @@ class AuthsTable:
except
:
return
None
def
update_user_password_by_id
(
self
,
id
:
str
,
password
:
str
,
new_password
:
str
)
->
bool
:
def
update_user_password_by_id
(
self
,
id
:
str
,
new_password
:
str
)
->
bool
:
try
:
auth
=
Auth
.
get
(
Auth
.
id
==
id
,
Auth
.
active
==
True
)
if
auth
:
if
verify_password
(
password
,
auth
.
password
):
query
=
Auth
.
update
(
password
=
new_password
).
where
(
Auth
.
id
==
id
)
result
=
query
.
execute
()
print
(
result
)
return
True
else
:
return
False
query
=
Auth
.
update
(
password
=
new_password
).
where
(
Auth
.
id
==
id
)
result
=
query
.
execute
()
print
(
result
)
return
True
except
:
return
False
...
...
backend/apps/web/routers/auths.py
View file @
500f61b7
...
...
@@ -69,7 +69,7 @@ async def update_password(form_data: UpdatePasswordForm, cred=Depends(bearer_sch
if
user
:
hashed
=
get_password_hash
(
form_data
.
new_password
)
return
Auths
.
update_user_password_by_id
(
user
.
id
,
form_data
.
password
,
hashed
)
return
Auths
.
update_user_password_by_id
(
user
.
id
,
hashed
)
else
:
raise
HTTPException
(
400
,
detail
=
ERROR_MESSAGES
.
INVALID_PASSWORD
)
else
:
...
...
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