Change change password error code to 400 to avoid automatic logout

This commit is contained in:
2026-04-07 22:07:04 +03:00
Unverified
parent 3b45cfda5c
commit f26425e9fa
+2 -1
View File
@@ -441,7 +441,8 @@ def change_password(
):
# Verify current derived password against stored hash
if not verify_password(password_request.currentPasswordDerived.strip(), current_user.password_hash):
raise HTTPException(status_code=401, detail="Текущий пароль неверный")
# 400 (not 401): mobile client treats 401 as global auth failure and clears the session.
raise HTTPException(status_code=400, detail="Текущий пароль неверный")
# Update password hash to hash of new derived password
current_user.password_hash = get_password_hash(password_request.newPasswordDerived.strip())