svthalia / concrexit

Thalia Website built on Django.
https://thalia.nu
Other
23 stars 11 forks source link

2FA numeric and autocomplete #3633

Closed JobDoesburg closed 2 months ago

JobDoesburg commented 4 months ago

What?

Make the 2FA TOTP field a

<input
  type="text"
  name="token"
  id="token"
  inputmode="numeric"
  pattern="[0-9]*"
  autocomplete="one-time-code"
/>

Why?

Hint browsers to display numeric 0-9 input mode, and autocomplete TOTPs (e.g. when using bitwarden)

How?

HTML ✨

DeD1rk commented 4 months ago

Actually only the inputmode is not already set, but e.g. ios+webkit picks the numpad just fine based on the pattern

DeD1rk commented 4 months ago

Any example of browsers/password managers that don't correctly discover the field?

JobDoesburg commented 4 months ago

Any example of browsers/password managers that don't correctly discover the field?

Bitwarden on iOS 17.4 safari

DeD1rk commented 4 months ago

But would that discover it with inputmode=numeric? Or would that also require the id+name to be precisely 'token'? In any case, if it's specific to that combination I think it would be better to make a PR to improve bitwardens detection...