diff --git a/backend/app/services/auth_service.py b/backend/app/services/auth_service.py index 91e34f9..fcb9798 100644 --- a/backend/app/services/auth_service.py +++ b/backend/app/services/auth_service.py @@ -41,5 +41,9 @@ def change_password( """ if not verify_password(current_password, user.hashed_password): raise BusinessRuleViolation("Current password is incorrect") + if verify_password(new_password, user.hashed_password): + raise BusinessRuleViolation( + "New password must be different from the current password" + ) user.hashed_password = hash_password(new_password) user.must_change_password = False