From fa213d95ee9c963559da315b7600b8ff2d29a9ec Mon Sep 17 00:00:00 2001 From: Bernard Siebens Date: Mon, 13 Jul 2026 23:11:06 +0200 Subject: [PATCH] Drop the placeholder from the otp field allauth sets placeholder="Code" on the field. Grey text sitting inside the otp boxes reads as an already-typed code, so it goes -- the sr-only label outside the box still names the field. Suppressed with placeholder=False rather than by deleting the key: as_widget() merges the widget's own attrs back in at render time, so popping it from a copy does nothing. Django's attribute template omits attrs whose value is False. Co-Authored-By: Claude Opus 4.8 --- authentication/tests.py | 4 ++++ controlpanel/templatetags/ui.py | 15 +++++++++++++++ templates/allauth/elements/fields.html | 2 +- 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/authentication/tests.py b/authentication/tests.py index b0c0270..6edb60b 100644 --- a/authentication/tests.py +++ b/authentication/tests.py @@ -265,6 +265,10 @@ class TwoFactorPageTests(TestCase): self.assertContains(self.response, 'name="code"') self.assertContains(self.response, "otp otp-lg") + def test_the_otp_field_has_no_placeholder(self): + # allauth sets placeholder="Code"; inside the boxes it reads as a typed-in code. + self.assertNotContains(self.response, 'placeholder="Code"') + def test_cancel_sits_beside_sign_in_and_is_not_primary(self): self.assertContains(self.response, '