Filter for adding login erorrs #4059
This commit is contained in:
parent
f1e6900359
commit
2c25568e21
|
@ -629,10 +629,17 @@ class WC_Form_Handler {
|
||||||
wp_verify_nonce( $_POST['_wpnonce'], 'woocommerce-login' );
|
wp_verify_nonce( $_POST['_wpnonce'], 'woocommerce-login' );
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$creds = array();
|
$creds = array();
|
||||||
|
|
||||||
|
$validation_error = new WP_Error();
|
||||||
|
$validation_error = apply_filters( 'woocommerce_process_login_errors', $validation_error, $_POST['username'], $_POST['password'] );
|
||||||
|
|
||||||
|
if ( $validation_error->get_error_code() )
|
||||||
|
throw new Exception( '<strong>' . __( 'Error', 'woocommerce' ) . ':</strong> ' . $validation_error->get_error_message() );
|
||||||
|
|
||||||
if ( empty( $_POST['username'] ) )
|
if ( empty( $_POST['username'] ) )
|
||||||
throw new Exception( '<strong>' . __( 'Error', 'woocommerce' ) . ':</strong> ' . __( 'Username is required.', 'woocommerce' ) );
|
throw new Exception( '<strong>' . __( 'Error', 'woocommerce' ) . ':</strong> ' . __( 'Username is required.', 'woocommerce' ) );
|
||||||
|
|
||||||
if ( empty( $_POST['password'] ) )
|
if ( empty( $_POST['password'] ) )
|
||||||
throw new Exception( '<strong>' . __( 'Error', 'woocommerce' ) . ':</strong> ' . __( 'Password is required.', 'woocommerce' ) );
|
throw new Exception( '<strong>' . __( 'Error', 'woocommerce' ) . ':</strong> ' . __( 'Password is required.', 'woocommerce' ) );
|
||||||
|
|
||||||
|
@ -687,7 +694,6 @@ class WC_Form_Handler {
|
||||||
|
|
||||||
// process lost password form
|
// process lost password form
|
||||||
if ( isset( $_POST['user_login'] ) ) {
|
if ( isset( $_POST['user_login'] ) ) {
|
||||||
|
|
||||||
wp_verify_nonce( $_POST['_wpnonce'], 'woocommerce-lost_password' );
|
wp_verify_nonce( $_POST['_wpnonce'], 'woocommerce-lost_password' );
|
||||||
|
|
||||||
WC_Shortcode_My_Account::retrieve_password();
|
WC_Shortcode_My_Account::retrieve_password();
|
||||||
|
|
Loading…
Reference in New Issue