The input fields for entering the one-time password in
the authentication views of TOTP and recovery codes
are improved by adding two new attributes:
autocomplete="one-time-code"
========================
In supporting browsers (mostly on mobile devices), this
allows them to suggest or even insert one-time passwords,
received e.g. via SMS.
See:
- https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete#values
- https://developer.apple.com/documentation/security/password_autofill/enabling_password_autofill_on_an_html_input_element
As a side effect this might also prevent browsers from
auto completing the fields with unsuitable data, since
this feature is usually enabled by default (autocomplete
attribute not set).
See: https://developer.mozilla.org/en-US/docs/Web/Security/Securing_your_site/Turning_off_form_autocompletion
inputmode="numeric"
=================
In supporting browsers (mostly on mobile devices), this
changes the keyboard layout to numeric. This is helpful,
since only digits of 0-9 are required / allowed.
See:
- https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/inputmode
- https://css-tricks.com/everything-you-ever-wanted-to-know-about-inputmode/#numeric