• Resolved flashjunkie

    (@flashjunkie)


    Hi, this plugin sounds like just what we need to help prevent users from sharing PWs etc.

    We use a theme which implements a ‘popup’ login window. It seems that the popup window uses code similar to this:

    $user_signon = wp_signon( $info, false );
    if ( is_wp_error($user_signon) ){
       //ECHO ERROR HERE
       } else {
       wp_set_current_user($user_signon->ID); 
       //Continue with login procedure...
    }

    It seems that by using wp_signon to authenticate the user that the ‘wp_authenticate_user’ hook isn’t applied and as such the ‘validate’ function in your plugin is not being called.

    I tried on several machines in several browsers and was able to login as many times as I wanted (settings on plugin are: ‘1’ and ‘block’)

    Fix I tried…

    Basically, I tried to force the filter to be applied using the following:

    
    $checkuser = get_user_by('email', $form_email);
    
    $possiblesharer = apply_filters( 'wp_authenticate_user', $checkuser, $form_pw );
    //
    if ( is_wp_error($possiblesharer) ){
       $error_string = $possiblesharer->get_error_message();
    
       //error message changed in plugin file to make this bit easier
       if($error_string == "TESTMSG") {
       
          echo json_encode(array('loggedin'=>false, 'message'=>esc_html__('You have logged into your account from too many devices, please log out from an existing device.','olam')));
    return;
    
       }
    
    } else {
    
       echo json_encode(array('loggedin'=>false, 'message'=>esc_html__('Unknown Error... Please try in 5 minutes','olam')));
       return;
    
    }
    
    $user_signon = wp_signon( $info, false );
    if ( is_wp_error($user_signon) ){
    
    ...
    ...
    ...

    Hoping you can help to get this up and running ??

    Many thanks,

    • This topic was modified 5 years, 2 months ago by flashjunkie.

    The page I need help with: [log in to see the link]

  • The topic ‘Not working with login window’ is closed to new replies.