From ea11b16f580356b238f0a2a53a9152f111f99171 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Fri, 8 Sep 2023 16:44:25 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=92=20chore(users.py):=20refactor=20re?= =?UTF-8?q?set=5Fpassword=20function=20to=20improve=20password=20verificat?= =?UTF-8?q?ion=20logic?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/langflow/api/v1/users.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/backend/langflow/api/v1/users.py b/src/backend/langflow/api/v1/users.py index dca8b23d2..1c464ec4c 100644 --- a/src/backend/langflow/api/v1/users.py +++ b/src/backend/langflow/api/v1/users.py @@ -18,6 +18,7 @@ from langflow.services.auth.utils import ( get_current_active_superuser, get_current_active_user, get_password_hash, + verify_password, ) from langflow.services.database.models.user.crud import ( get_user_by_id, @@ -125,11 +126,11 @@ def reset_password( if not user: raise HTTPException(status_code=404, detail="User not found") - new_password = get_password_hash(user_update.password) - if new_password == user.password: + if verify_password(user_update.password, user.password): raise HTTPException( status_code=400, detail="You can't use your current password" ) + new_password = get_password_hash(user_update.password) user.password = new_password session.commit() session.refresh(user)