mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-06-05 15:09:37 +09:00
- possible solution for #1091;
This commit is contained in:
@@ -59,18 +59,29 @@ function um_submit_form_errors_hook_login( $args ) {
|
||||
UM()->form()->add_error( 'user_password', __( 'Password is incorrect. Please try again.', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
// Integration with 3rd-party login handlers e.g. 3rd-party reCAPTCHA etc.
|
||||
$third_party_codes = apply_filters( 'um_custom_authenticate_error_codes', array() );
|
||||
|
||||
// @since 4.18 replacement for 'wp_login_failed' action hook
|
||||
// see WP function wp_authenticate()
|
||||
$ignore_codes = array( 'empty_username', 'empty_password' );
|
||||
|
||||
$user = apply_filters( 'authenticate', null, $authenticate, $args['user_password'] );
|
||||
if ( is_wp_error( $user ) && ! in_array( $user->get_error_code(), $ignore_codes ) ) {
|
||||
UM()->form()->add_error( $user->get_error_code(), __( 'Password is incorrect. Please try again.', 'ultimate-member' ) );
|
||||
if ( ! empty( $third_party_codes ) && in_array( $user->get_error_code(), $third_party_codes ) ) {
|
||||
UM()->form()->add_error( $user->get_error_code(), $user->get_error_message() );
|
||||
} else {
|
||||
UM()->form()->add_error( $user->get_error_code(), __( 'Password is incorrect. Please try again.', 'ultimate-member' ) );
|
||||
}
|
||||
}
|
||||
|
||||
$user = apply_filters( 'wp_authenticate_user', $user, $args['user_password'] );
|
||||
if ( is_wp_error( $user ) && ! in_array( $user->get_error_code(), $ignore_codes ) ) {
|
||||
UM()->form()->add_error( $user->get_error_code(), __( 'Password is incorrect. Please try again.', 'ultimate-member' ) );
|
||||
if ( ! empty( $third_party_codes ) && in_array( $user->get_error_code(), $third_party_codes ) ) {
|
||||
UM()->form()->add_error( $user->get_error_code(), $user->get_error_message() );
|
||||
} else {
|
||||
UM()->form()->add_error( $user->get_error_code(), __( 'Password is incorrect. Please try again.', 'ultimate-member' ) );
|
||||
}
|
||||
}
|
||||
|
||||
// if there is an error notify wp
|
||||
|
||||
Reference in New Issue
Block a user