• I just installed WordPress for the first time and I am completely amazed at all the problems. Same issues, release after release which are tagged in the forums as resolved.

    Initially my pages didn’t even show up until I found this plugin (which of course isn’t even listed in the plugins).
    Plugin Name: Disable Canonical URL Redirection
    https://txfx.net/files/wordpress/disable-canonical-redirects.phps

    Login reloads login page
    As for the logging in issue, what is happening is that the cookies are not being sent with the header redirection.

    Many users have also indicated that their installation worked fine for a few months before this error started occurring. Which I’m sure was a result of clearing or deleting their cookies (because they were never actually logged out).

    Once you do get logged in, you may also have noticed that when you logout you are not actually logged out. After you have clicked the logout link you are redirected back to the login page (which is what should happen). If you simply change wordpress/wp-login.php to wordpress/wp-admin/ in the address bar, you are logged in with out having to provide any credentials. This to is a result of the logout redirection header not sending the cookies to destroy the cookies in the browser.

    The code I have included here is nothing less than a hack but does force the cookies to be sent which in turn allows you to log in and out correctly.

    In wp-login.php:
    first go to the case ‘logout’ : section and add

    if ( isset($_COOKIE[TEST_COOKIE]) ) {
      if($_COOKIE[TEST_COOKIE] == "set")  { //LOGGED_IN_COOKIE
      setcookie(TEST_COOKIE, ' ', time() - 31536000, SITECOOKIEPATH, COOKIE_DOMAIN);
      exit("<div style='text-align:center; color:red;'>Click refresh to continue...</div>");
      }
    }
    wp_safe_redirect($redirect_to);

    Then locate the case ‘login’ : section and add

    if ( isset($_COOKIE[TEST_COOKIE]) ) {
      if($_COOKIE[TEST_COOKIE] != "set")  {
        setcookie(TEST_COOKIE, 'set', 0, COOKIEPATH, COOKIE_DOMAIN);
        exit("<div style='text-align:center; color:red;'>Click refresh to continue...<br />$redirect_to</div>");
      }
    }
    wp_safe_redirect($redirect_to);

    Note: new code is the stuff above the line containing:
    wp_safe_redirect($redirect_to); in both cases.

    As I said this is a Hack but until the developers fix it properly you will be able to log in and out properly.

    So far the 5 minute install is in excess of 40 hours.

    I also installed MovableType. After I upgraded the required perl modules it was up and running perfectly.

    Although I prefer the PHP environment over Perl, from what I have read in the forums about ongoing unresolved issues release after release and some in excess of a year I find myself “HardPressed to recommend WordPress” to any body.

    Hopefully this Hack will allow some of you to login.

    Regards

    (This is a Hack so it should never be marked as resolved for this version)

Viewing 9 replies - 1 through 9 (of 9 total)
  • Thread Starter glenara

    (@glenara)

    Update:
    In the side bar of this post it refers to WordPress version 2.8.5 which is not correct. The version I installed is 2.8.6

    Also since manually refreshing the page to login and logout is a bit of a nuisance I’ve revised the exit code to do the refresh automatically.

    Instead of the original post which was:
    exit("<div style='text-align:center; color:red;'>Click refresh to continue...<br />$redirect_to</div>");
    Use this instead:
    exit('<script type="text/javascript">window.location.assign("'.$redirect_to.'");</script>');
    Replace it in both the logout and login sections. Now you won’t have to refresh the page after you click the login or logout buttons.

    My original php version was 5.2.2 and have since upgraded to php 5.2.12
    The problem still exists in php 5.2.12 so I think it safe to say this isn’t a php bug or issue.

    Regards.

    Thread Starter glenara

    (@glenara)

    exit('<script type="text/javascript">window.location.assign("'.$redirect_to.'");</script>');

    Hi Glenara –

    I’m struggling with a site has been working fine (wordpress 2.9.1) until recently I’ve been unable to log into the admin page. I’ll enter my username and password, and upon clicking enter the page refreshes and the fields simply clear themselves. No warning messages. I’ve tried everything I can find in these forums, and I’ve had no luck. I hoped maybe the hack you detailed above might work – but it hasn’t seemed to change anything for me. I realize, of course, that it was intended for 2.8.6 installs – so I figured it might not apply to my situation.

    Just in case though, here’s what I’ve done. I found case ‘logout’ and pasted the following just above the wp_safe_redirect line:

    if ( isset($_COOKIE[TEST_COOKIE]) ) {
      if($_COOKIE[TEST_COOKIE] == "set")  { //LOGGED_IN_COOKIE
      setcookie(TEST_COOKIE, ' ', time() - 31536000, SITECOOKIEPATH, COOKIE_DOMAIN);
      exit('<script type="text/javascript">window.location.assign("'.$redirect_to.'");</script>');
      }
    }

    Then, I found case ‘login’ and added this code just above the wp_safe_redirect line:

    if ( isset($_COOKIE[TEST_COOKIE]) ) {
      if($_COOKIE[TEST_COOKIE] != "set")  {
        setcookie(TEST_COOKIE, 'set', 0, COOKIEPATH, COOKIE_DOMAIN);
        exit('<script type="text/javascript">window.location.assign("'.$redirect_to.'");</script>');
      }
    }

    I re-uploaded the page, cleared my browsers cookies and cache, went to the login screen and . . . nothing changed. After entering my login info, the page simply refreshes and clears the fields.

    I’m at a loss here. Any other thoughts?

    Many thanks.

    Photorestorationman

    (@photorestorationman)

    Did you get this resolved as I am having the same problems??

    many thanks

    bwesty

    (@bwesty)

    I’m having this problem as well. I’d rather not go with the hack so if this has been resolved I’d love to know about it.

    Hello WordPress Tech Team,

    Please help with the following issues:

    1) Unable to Login – Not accepting correct username and password
    2) Login page is reloading even after logging in and all the tabs are getting freezed
    3) Tried by clearing cache and cookies still no success

    Using Firefox 3.0.6.

    Please help.
    Sandeep

    I have the same problem.
    Did not upgrade word-press version and even user name and pass are correct I am continually getting login screen with empty fields.

    Hey All, I know this issue keeps coming up and I found a solution for me a few months ago and never posted. Here is another one. In the wp-config.php add this

    /** Added to  fix issue with the login. */
    define('ADMIN_COOKIE_PATH', '/');

    After the DB_COLLATE lines. Hope this works for you.

    Any other solutions if orbital’s fix doesn’t work for me? Even incorrect credentials reloads the page — the warning/error in a red box doesn’t appear… Thanks in advance for any insight!

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Login reloads login page’ is closed to new replies.