• Resolved andy_woz

    (@andy_woz)


    Is there a way to get this working with the wp_login_form() function? Currently it send the user to wp-login.php with a message ‘Error: The one-time password (TFA code) you entered was incorrect.’ and the user has to attempt to log in again.

    Thanks,

    A

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author David Anderson / Team Updraft

    (@davidanderson)

    Hi Andy,

    What does “working with the wp_login_form() function” mean in practice? That’s a bit too compressed for me to know what is being talked about (other than some internal WP function).

    David

    Thread Starter andy_woz

    (@andy_woz)

    Hi David, the wp_login_form() function allows you to add a login form to your page template, useful if you want to build a custom login page.

    <?php $args = array(
            'echo' => true,
            'redirect' => 'https://yoursite.com',
            'form_id' => 'loginform',
            'label_username' => __( 'Username' ),
            'label_password' => __( 'Password' ),
            'label_remember' => __( 'Remember Me' ),
            'label_log_in' => __( 'Log In' ),
            'id_username' => 'user_login',
            'id_password' => 'user_pass',
            'id_remember' => 'rememberme',
            'id_submit' => 'wp-submit',
            'remember' => true,
            'value_username' => NULL,
            'value_remember' => false 
    );
    
    wp_login_form($args);
    
    ?>

    I was assuming that as this follows the wordpress login protools it would work with the 2FA plugin. It seems that it does not and was wondering if you had any thoughts on how to get it display the 2FA input fields without it redirecting to wp-login.php with an authentication error. Is there an extra argument I can pass or a filter I can add to get it to recognize the plugin?

    Thanks.

    Plugin Author David Anderson / Team Updraft

    (@davidanderson)

    You need to enqueue the plugin’s JavaScript. Without doing that, the plugin is not active on the page. wp_login_form() is just an internal WP function that is generating the login form HTML, but WP does many more things when setting up a login form than that. They one you need to do to make sure the plugin is aware that it’s a login page is call this somewhere during the page generation:

    
    do_action('login_form');
    

    Whether that works with your way of trying to generate a login form, I cannot say – I’ve not attempted it. But the above action call will at least ensure that the JS is enqueued for the page.

    David

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to with wp_login_form()’ is closed to new replies.