Skip to content
This repository was archived by the owner on May 26, 2025. It is now read-only.

Commit 8e0bc81

Browse files
[Bug] Fix hashing password (#25)
Use password hashing method instead of class because it'll return 500 ERROR from calling `/token` API if patching a user's password afterwards. This change has tested in local development env.
1 parent 755d70f commit 8e0bc81

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

project_name/routes/user.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99
AdminUser,
1010
AuthenticatedFreshUser,
1111
AuthenticatedUser,
12-
HashedPassword,
1312
User,
1413
UserCreate,
1514
UserPasswordPatch,
1615
UserResponse,
1716
get_current_user,
17+
get_password_hash,
1818
)
1919

2020
router = APIRouter()
@@ -72,7 +72,7 @@ async def update_user_password(
7272
raise HTTPException(status_code=400, detail="Passwords don't match")
7373

7474
# Update the password
75-
user.password = HashedPassword(patch.password)
75+
user.password = get_password_hash(patch.password)
7676

7777
# Commit the session
7878
session.commit()

0 commit comments

Comments
 (0)