-
Notifications
You must be signed in to change notification settings - Fork 177
added filter to control whether authcode autosubmits #741
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
base: master
Are you sure you want to change the base?
Changes from 3 commits
808cd6a
00605f2
bd499ec
5acf913
aac5403
628a461
da121df
749a8f0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -958,6 +958,7 @@ public static function login_html( $user, $login_nonce, $redirect_to, $error_msg | |||
| $interim_login = isset( $_REQUEST['interim-login'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended | ||||
|
|
||||
| $rememberme = intval( self::rememberme() ); | ||||
| $auto_submit_authcode = apply_filters( 'two_factor_auto_submit_authcode', true ); | ||||
|
masteradhoc marked this conversation as resolved.
Outdated
|
||||
|
|
||||
| if ( ! function_exists( 'login_header' ) ) { | ||||
| // We really should migrate login_header() out of `wp-login.php` so it can be called from an includes file. | ||||
|
|
@@ -976,7 +977,7 @@ public static function login_html( $user, $login_nonce, $redirect_to, $error_msg | |||
| } | ||||
| ?> | ||||
|
|
||||
| <form name="validate_2fa_form" id="loginform" action="<?php echo esc_url( self::login_url( array( 'action' => $action ), 'login_post' ) ); ?>" method="post" autocomplete="off"> | ||||
| <form name="validate_2fa_form" id="loginform" action="<?php echo esc_url( self::login_url( array( 'action' => $action ), 'login_post' ) ); ?>" method="post" autocomplete="off"<?php if ( $auto_submit_authcode ) { ?> data-auto-submit="true"<?php } ?>> | ||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I appreciate this running through a data attribute -- though as I'm looking at a bit of code from TOTP that adds a
that's what populates the Also, kind of out-of-scope for this, but I'd like to see the autosubmit also work for codes that are alphanumeric or the like, so if it could maybe be elevated out of the "only numbers" conditional, but that's minor quibbles. |
||||
| <input type="hidden" name="provider" id="provider" value="<?php echo esc_attr( $provider_key ); ?>" /> | ||||
| <input type="hidden" name="wp-auth-id" id="wp-auth-id" value="<?php echo esc_attr( $user->ID ); ?>" /> | ||||
| <input type="hidden" name="wp-auth-nonce" id="wp-auth-nonce" value="<?php echo esc_attr( $login_nonce ); ?>" /> | ||||
|
|
@@ -1076,8 +1077,8 @@ function() { | |||
|
|
||||
| this.value = value; | ||||
|
|
||||
| // Auto-submit if it's the expected length. | ||||
| if ( expectedLength && value.replace( / /g, '' ).length == expectedLength ) { | ||||
| // Auto-submit if auto-submit is enabled and entered value is the expected length. | ||||
| if ( form.dataset.autoSubmit && expectedLength && value.replace( / /g, '' ).length == expectedLength ) { | ||||
| if ( undefined !== form.requestSubmit ) { | ||||
| form.requestSubmit(); | ||||
| form.submit.disabled = "disabled"; | ||||
|
|
||||
Uh oh!
There was an error while loading. Please reload this page.