Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Kevin Vess

    (@kevinvess)

    The browser and OS shouldn’t be a factor in the cause of any issues you’re having because the plugin code runs on the server-side and does not affect the front-end. So, we can rule that out as the cause.

    When I say log in twice, I mean enter user and pass and the form just refreshes. User is still there, enter password again, and then it works.

    I assume the first attempt is with the URL: https://www.website.com/blog and then what URL does the browser’s address bar show after the first login attempt?

    Also, does the login screen work from either URL without the my_forcelogin_redirect() added to the functions.php file? Have you tried using just return site_url();?

    I suspect this isn’t an issue with the plugin, but might be caused by how you’ve installed WordPress on your server. Specifically as to how your server is handling URLs with and without a trailing forward slash.

    Thread Starter edhillis

    (@edhillis)

    Thanks for your help!

    I’m sorry, my first message was incorrect as I discovered that the trailing slash didn’t really have an effect on the problem one way or the other.

    It happens for me on Firefox, but not IE or Chrome.

    I enter https://www.website.com/blog, and this takes me to the login prompt with the address
    https://www.website.com/blog/wp-login.php?redirect_to=http%3A%2F%2Fwww.website.com%2Fblog%2F

    I try to log in there, and the page refreshes and the address is the same. I submit the form again and get in.

    If I use “return site_url();”, I never get past the login prompt.

    This seems to happen only if I have the blog home page as the redirect target (whether by using my_forcelogin_redirect or, with my_forcelogin_redirect removed from functions.php, just the default behavior after browsing to that url). This also happens if I set the redirect explicitly to “/blog/index.php”. If I change the redirect target to something like …?page_id=xxx, it works fine.

    When I change the redirect target from something else back to the homepage, (in Firefox again) everything works properly for three or four visits, and then the login form starts repeating again.

    After the first time through the login form, I’m actually logged into the blog — I can browse directly to a subpage — even though it appears that I still need to log in.

    It seems like Firefox is caching the original redirect (from homepage to login form). Or there is a timing issue — I’ve logged in and it’s redirecting me the homepage, but somehow WordPress doesn’t know that I’ve logged in yet, so it forces me to the the login form again.

    Plugin Author Kevin Vess

    (@kevinvess)

    Interesting –?I had one other person tell me that they experienced a small subset of Firefox users who also had issues logging-in, but I wasn’t able to reproduce the issue and figured it was unique to their environment.

    What server are you running your website on? And is your site using an SSL connection?

    Would you mind trying the following change to the wp-force-login.php plugin file to see if this fixes your issue?

    On line 42, change the redirect function to this:
    wp_redirect( wp_login_url( $redirect_url ), 302 ); exit();

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘have to log in twice after opening Firefox’ is closed to new replies.