fix: narrow type for PasswordChange to satisfy type checker
Use isinstance check instead of bool flag to help ty resolve the current_password attribute on the validated model. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
d7cdedbd5f
commit
2745471412
1 changed files with 1 additions and 1 deletions
|
|
@ -82,7 +82,7 @@ async def set_password(
|
||||||
return HTMLResponse(format_validation_errors(exc))
|
return HTMLResponse(format_validation_errors(exc))
|
||||||
|
|
||||||
# Verify current password if changing
|
# Verify current password if changing
|
||||||
if has_password:
|
if has_password and isinstance(validated, PasswordChange):
|
||||||
if not password_service.verify(existing.password_hash, validated.current_password):
|
if not password_service.verify(existing.password_hash, validated.current_password):
|
||||||
return HTMLResponse('<div role="alert">Current password is incorrect</div>')
|
return HTMLResponse('<div role="alert">Current password is incorrect</div>')
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue