Skip to content

Commit c758358

Browse files
Jeny SadadiaJenySadadia
Jeny Sadadia
authored andcommitted
api/main.py: fix authorization issue
Fix CryptContext.verify failing with correct username and password. Need to use get_secret_value() to get password in plain text while getting hash from password of type SecretStr. Fixes: c3173b2 ("api/models.py: use secret type for password") Signed-off-by: Jeny Sadadia <[email protected]>
1 parent 2e3c506 commit c758358

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

api/main.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ async def read_users_me(current_user: User = Depends(get_user)):
141141
@app.post('/hash')
142142
def get_password_hash(password: Password):
143143
"""Get a password hash from the provided string password"""
144-
return auth.get_password_hash(str(password.password))
144+
return auth.get_password_hash(password.password.get_secret_value())
145145

146146

147147
# -----------------------------------------------------------------------------

0 commit comments

Comments
 (0)