From f64999ead4af3abc46a28f2d1ce579a70103dbe6 Mon Sep 17 00:00:00 2001 From: chriscarrollsmith Date: Tue, 23 Jun 2026 11:02:49 -0400 Subject: [PATCH 1/2] fix: restore confirm-password autocomplete regression test PR #195 accidentally deleted the def line for test_register_page_confirm_password_has_autocomplete, collapsing its body into test_register_page_shows_password_requirements and demoting its docstring to a no-op string statement. This restored the issue #156 autocomplete check as its own test. Co-authored-by: Cursor --- tests/routers/core/test_account.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/routers/core/test_account.py b/tests/routers/core/test_account.py index 22548a9..382c40a 100644 --- a/tests/routers/core/test_account.py +++ b/tests/routers/core/test_account.py @@ -450,6 +450,9 @@ def test_register_page_shows_password_requirements(unauth_client: TestClient): assert 'name="comm_opt_in"' in html assert 'name="comm_updates"' in html assert 'name="comm_marketing"' in html + + +def test_register_page_confirm_password_has_autocomplete(unauth_client: TestClient): """Issue #156: Both password fields must have autocomplete='new-password' for Chrome autofill.""" response = unauth_client.get(app.url_path_for("read_register")) assert response.status_code == 200 From 31631aec3b2c460ece99d1995a8d5def97185c7a Mon Sep 17 00:00:00 2001 From: chriscarrollsmith Date: Tue, 23 Jun 2026 11:12:12 -0400 Subject: [PATCH 2/2] refactor: inline syncSubPreferences into master change handler The syncSubPreferences helper was only invoked from the master checkbox's change handler (disable branch) and never on init, where initial visibility is already set server-side via Jinja. Inlining it removes the indirection and the asymmetry between the enable and disable paths while preserving behavior: enabling reveals the sub-preferences and checks updates; disabling hides them and clears both sub-preferences. Co-authored-by: Cursor --- .../partials/communication_preferences_fields.html | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/templates/partials/communication_preferences_fields.html b/templates/partials/communication_preferences_fields.html index 928c6bc..14d60a4 100644 --- a/templates/partials/communication_preferences_fields.html +++ b/templates/partials/communication_preferences_fields.html @@ -54,23 +54,15 @@ return; } - function syncSubPreferences() { + master.addEventListener('change', function () { if (master.checked) { subPrefs.style.display = ''; + updates.checked = true; } else { subPrefs.style.display = 'none'; updates.checked = false; marketing.checked = false; } - } - - master.addEventListener('change', function () { - if (master.checked) { - subPrefs.style.display = ''; - updates.checked = true; - } else { - syncSubPreferences(); - } }); }); })();