Add autocomplete "one-time-code" attribute#657
Merged
Conversation
kasparsd
reviewed
Jan 9, 2025
Collaborator
kasparsd
left a comment
There was a problem hiding this comment.
I reviewed a few of the industry examples like GitHub and it appears that there is an update spec for the autocomplete values so we could use those instead:
https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete#one-time-code
Any concerns with this approach?
| $placeholder = sprintf( __( 'eg. %s', 'two-factor' ), '123456' ); | ||
| ?> | ||
| <input type="tel" name="two-factor-totp-authcode" id="two-factor-totp-authcode" class="input" value="" size="20" pattern="[0-9 ]*" placeholder="<?php echo esc_attr( $placeholder ); ?>" /> | ||
| <input type="text" inputmode="numeric" name="two-factor-totp-authcode" id="two-factor-totp-authcode" class="input" value="" size="20" pattern="[0-9 ]*" placeholder="<?php echo esc_attr( $placeholder ); ?>" autocomplete="off" /> |
Collaborator
There was a problem hiding this comment.
I just confirmed that GitHub is also using text input type with numeric inputmode:
But they also have autocomplete="one-time-code" (per spec), so I wonder if we actually need to change that to match.
Contributor
Author
|
@kasparsd Looks good to me, I just changed |
kasparsd
approved these changes
Jan 9, 2025
Collaborator
kasparsd
left a comment
There was a problem hiding this comment.
This is great, thank you!
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

What?
This PR disables autocompletion for authcode input fields.
Why?
Since authcode are always unique, autocompletion is not useful here.
How?
Testing Instructions
Screenshots or screencast
Changelog Entry
Added - Disabled autocompletion for authcode input fields.
Fixed - Corrected input type.