Skip to content

Conversation

@CGHoussem
Copy link

This change adds an id="totp" attribute to the TOTP input field on the login page.

This helps password managers (such as Bitwarden, 1Password, and others) automatically detect and eventually fill the TOTP code field when using saved logins that include a 2FA token.

Why

Without a clear identifier, most password managers fail to recognize the TOTP input automatically, forcing users to manually copy/paste the 2FA code.
This small change improves usability and accessibility for users who rely on password managers.

Testing

  • Verified that the TOTP field still works correctly for manual input.
  • Confirmed that Bitwarden now correctly auto-fills the TOTP field when a matching entry is present.

@CLAassistant
Copy link

CLAassistant commented Nov 9, 2025

CLA assistant check
All committers have signed the CLA.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Nov 9, 2025

@DeepDiver1975
Copy link
Member

autofill=one-time-code

This should be the way to go from my understanding.

https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Attributes/autocomplete

@CGHoussem
Copy link
Author

CGHoussem commented Nov 11, 2025

autofill=one-time-code

This should be the way to go from my understanding.

https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Attributes/autocomplete

I have first tested to set the autocomplete field to "one-time-code", but that alone didn't work for the password manager Bitwarden (haven't tested other password managers).

What worked for me either adding the field id and setting it to "totp" or changing the name field from "challenge" to "totp" (at least that's how Bitwarden figures out the one time code field).

I suggest updating the value of the name field to "totp-challenge" (which also works). This change resolves the issue with Bitwarden (and possibly other password managers) and, as a bonus, aligns the name field’s value with the one used for similar inputs in the settings page:

+ ' <input type="text" id="totp-challenge" required="required" type="tel" minlength="6" maxlength="6" autocomplete="off" placeholder="' + t('twofactor_totp', 'Authentication code') + '">'

If you are okay with the idea, I'll update the PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants