✨ Add reauth flow (finding C7) #23
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/c7-reauth"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Closes finding C7.
Since PR #14 the coordinator already maps 401/403 to
ConfigEntryAuthFailed, but without a reauth step the user has no way to recover short of deleting and re-adding the integration (which orphans every entity's history). This PR adds the missingasync_step_reauth+async_step_reauth_confirm:async_step_reauthautomatically whenConfigEntryAuthFailedis raised (or when the user clicks Reconfigure).validate_inputhelper as the user step — sameinvalid_auth/cannot_connect/unknownerror surface.async_update_reload_and_abortwrites the new password intoentry.data, reloads the entry so the coordinator reconnects with the fresh creds, and aborts withreauth_successful.Also cleaned up:
hostfield fromstrings.json/translations/en.json— it referenced a schema entry that never existed.validate_inputnow returnsNoneand raises on error (was returning a{title}dict only used in one caller).Test plan
test_reauth_prompts_for_new_password— form rendered, username in placeholders.test_reauth_happy_path_updates_password— entry data updated, abort reasonreauth_successful,authenticatecalled with new password.test_reauth_invalid_auth_keeps_form_open— entry data unchanged on invalid_auth.test_reauth_cannot_connect_keeps_form_open— entry data unchanged on cannot_connect.pytest tests/→ 28 passed;ruff+mypyclean.ConfigEntryAuthFailed, then confirming the HA Settings → Repairs prompts for a new password and the integration comes back healthy after you enter the real one.52934867cdf58af6f23fView command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.