bug: old_password not validated before check_password call
Description
old_password is retrieved from request.data but never checked for None/empty before being passed to check_password(), unlike new_password which has an explicit guard at line 188.
Steps to reproduce
- Open
authentication/views.pyaround line 184 - When old_password is absent from the request, check_password(None, user.password) silently returns False and the response is 'Invalid old password' instead of 'Old password is required', masking the real error.
Expected behavior
The None guard added for new_password (line 188-192) was not added symmetrically for old_password. should be handled correctly.
Actual behavior
When old_password is absent from the request, check_password(None, user.password) silently returns False and the response is 'Invalid old password' instead of 'Old password is required', masking the real error.
This issue has been marked as stale because it has had no activity for 30 days. If you are still working on this, please provide some updates.
Hi, I have read authentication/views.py around line 184. The old_password path has no None/empty guard before check_password, so a missing field returns 'Invalid old password' instead of a clear error.
I can add the guard mirroring the new_password check at line 188, plus a test for the missing-field case.
Can I be assigned?
@zcosmicw thanks for the analysis. Looks like this was addressed in #4064 (merged into develop) — line 189 now has the if not old_password guard returning 400 with "Old password is required." before reaching check_password. The behavior described in the issue should no longer reproduce on the current develop branch.