How to set custom validation for WordPress Passwords?

By Using following hook, you can customize your login page and password validations with ajax or PHP.

add_action( 'login_form', 'myplugin_add_login_fields' );

function myplugin_add_login_fields() {

    //Get and set any values already sent
    $user_extra = ( isset( $_POST['user_extra'] ) ) ? $_POST['user_extra'] : '';
    ?>

    <p>
        <label for="user_extra"><?php _e('Extra Field','mydomain') ?><br />
            <input type="text" name="user_extra" id="user_extra" class="input" value="<?php echo esc_attr(stripslashes($user_extra)); ?>" size="25" /></label>
    </p>

    <?php
}

Let me know, I case of any issues.