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:
Johan Lundberg 2026-03-31 15:37:52 +02:00
parent d7cdedbd5f
commit 2745471412
No known key found for this signature in database
GPG key ID: A6C152738D03C7D1

View file

@ -82,7 +82,7 @@ async def set_password(
return HTMLResponse(format_validation_errors(exc))
# 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):
return HTMLResponse('<div role="alert">Current password is incorrect</div>')