ID, '_atbdp_recovery_key', true ); if ( ! empty( $_POST['directorist_reset_password'] ) && directorist_verify_nonce( 'directorist-reset-password-nonce', 'reset_password' ) && ( $db_key === $key ) ) : // Ignore password sanitization $password_1 = isset( $_POST['password_1'] ) ? $_POST['password_1'] : ''; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized $password_2 = isset( $_POST['password_2'] ) ? $_POST['password_2'] : ''; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized if ( ( $password_1 === $password_2 ) && ! empty( $password_1 && $password_2 ) ) : $update_user = wp_update_user( [ 'ID' => $user->ID, 'user_pass' => $password_2, ] ); if ( $update_user ) : ?>

%s

', 'best-listing' ), " " . $recpass_text . '' ); echo wp_kses_post( $output ); endif; ?>

ID, '_atbdp_recovery_key', $random_password ); // if update user return true then lets send user an email containing the new password if ( $update_user ) { $subject = esc_html__( ' Password Reset Request', 'best-listing' ); //$message = esc_html__('Your new password is: ', 'directorist') . $random_password; $site_name = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ); $message = __( 'Someone has requested a password reset for the following account:', 'best-listing' ) . '
'; /* translators: %s: site name */ $message .= sprintf( __( 'Site Name: %s', 'best-listing' ), $site_name ) . '
'; /* translators: %s: user login */ $message .= sprintf( __( 'User: %s', 'best-listing' ), $user->user_login ) . '
'; $message .= __( 'If this was a mistake, just ignore this email and nothing will happen.', 'best-listing' ) . '
'; $message .= __( 'To reset your password, visit the following address:', 'best-listing' ) . '
'; $link = [ 'key' => $random_password, 'user' => $email, ]; $message .= '' . esc_url( add_query_arg( $link, ATBDP_Permalink::get_login_page_url() ) ) . ''; $message = atbdp_email_html( $subject, $message ); $headers[] = 'Content-Type: text/html; charset=UTF-8'; $mail = wp_mail( $email, $subject, $message, $headers ); if ( $mail ) { $success = __( 'A password reset email has been sent to the email address on file for your account, but may take several minutes to show up in your inbox.', 'best-listing' ); } else { $error = __( 'Something went wrong, unable to send the password reset email. If the issue persists please contact with the site administrator.', 'best-listing' ); } } else { $error = __( 'Oops something went wrong updating your account.', 'best-listing' ); } } if ( ! empty( $error ) ) { $output = '

' . __( 'ERROR:', 'best-listing' ) . ' ' . $error . '

'; echo wp_kses_post( $output ); } if ( ! empty( $success ) ) { echo ''; } endif; ?>