The self-service credential delete handlers counted credentials and then deleted in separate steps, so concurrent deletes could each see >1 and both proceed, removing the user's last credential and locking them out. Add atomic delete_password_if_not_last / delete_webauthn_if_not_last repo methods (count + delete in one conditional statement) and use them in the manage delete handlers. Removes the now-unused _count_credentials helper. Refs: porchlight-2nv Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| __init__.py | ||
| conftest.py | ||
| test_db.py | ||
| test_exceptions.py | ||
| test_migrations.py | ||
| test_protocols.py | ||
| test_sqlite_consent_repo.py | ||
| test_sqlite_credential_repo.py | ||
| test_sqlite_magic_link_repo.py | ||
| test_sqlite_user_repo.py | ||