-
Notifications
You must be signed in to change notification settings - Fork 160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add autocomplete "one-time-code" attribute #657
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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?
@@ -349,7 +349,7 @@ public function user_two_factor_options( $user ) { | |||
/* translators: Example auth code. */ | |||
$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" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
@kasparsd Looks good to me, I just changed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great, thank you!
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.