Skip to content

Commit

Permalink
use error api instead of traversing
Browse files Browse the repository at this point in the history
mebbe fix test with type checking
  • Loading branch information
rebeccahum committed Oct 24, 2023
1 parent 0016f4a commit 9988539
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions security/login-error.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,13 @@ function use_ambiguous_login_error( $error ): string {
*/
function use_ambiguous_confirmation( $errors ): WP_Error {
if ( isset( $_GET['checkemail'] ) && 'confirm' === $_GET['checkemail'] ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
foreach ( $errors as &$err ) {
if ( isset( $err['confirm'][0] ) ) {
$err['confirm'][0] = FORGET_PWD_MESSAGE;
}
$messages = $errors->get_error_messages( 'confirm' );
if ( ! empty( $messages ) ) {
$errors->remove( 'confirm' );
$errors->add( 'confirm', FORGET_PWD_MESSAGE, 'message' );
}
}

return $errors;
}
add_filter( 'wp_login_errors', __NAMESPACE__ . '\use_ambiguous_confirmation', 99 );

0 comments on commit 9988539

Please sign in to comment.