"git@developer.sourcefind.cn:gaoqiong/migraphx.git" did not exist on "e314f8fbf575be9dcd40dd0aab8302c11ecb03bb"
Commit 500f61b7 authored by Timothy J. Baek's avatar Timothy J. Baek
Browse files

chore: update password refac

parent d8bb19fd
......@@ -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
......
......@@ -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:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment