Remove redundant / awkward empty password check

WooCommerce here checks that the password is not empty. This check is redundant, because it is already performed by wp_authenticate_email_password() (which is invoked, eventually, by the call in WC to wp_signon() ). Moreover, it is harmful, because it prevents extension of the login form. For example, in my use case, I have added a code to be scanned by a smartphone app as an alternative to the password. When the code is scanned, a password is required.

This extra/redundant check for an empty password on the WooCommerce form prevents my already-working-on-the-standard-wp-login-form code from working here, and there's no way to work around it that isn't hacky/ugly (e.g. direct manipulation of $_POST).
This commit is contained in:
David Anderson 2017-03-21 23:21:43 +00:00 committed by GitHub
parent 795e6871c0
commit 57ab34f13e
1 changed files with 0 additions and 4 deletions

View File

@ -879,10 +879,6 @@ class WC_Form_Handler {
throw new Exception( '<strong>' . __( 'Error:', 'woocommerce' ) . '</strong> ' . __( 'Username is required.', 'woocommerce' ) );
}
if ( empty( $_POST['password'] ) ) {
throw new Exception( '<strong>' . __( 'Error:', 'woocommerce' ) . '</strong> ' . __( 'Password is required.', 'woocommerce' ) );
}
if ( is_email( $username ) && apply_filters( 'woocommerce_get_username_from_email', true ) ) {
$user = get_user_by( 'email', $username );