Admin login page just reloads without errors

Sometimes entering correct admin login/password and hitting the submit button just reloads the backend page without any errors.

One may find different ways to fix it yet none of them worked for us. So we decided to provide the full solution to this problem.

  1. You should edit the following file app/code/core/Mage/Core/Model/Session/Abstract/Varien.php. This is Magento core file so don’t forget to backup it before changing.
  2. Find the code:

    $cookieParams = array(
      'lifetime' => $cookie->getLifetime(),
      'path'     => $cookie->getPath(),
      'domain'   => $cookie->getConfigDomain(),
      'secure'   => $cookie->isSecure(),
      'httponly' => $cookie->getHttponly()
    );
    
    and replace it with this one:

    $cookieParams = array(
      'lifetime' => $cookie->getLifetime(),
      'path'     => $cookie->getPath(),
      //'domain'   => $cookie->getConfigDomain(),
      //'secure'   => $cookie->isSecure(),
      //'httponly' => $cookie->getHttponly()
    );
    
    so basically you need to comment 3 lines out.
    
  3. Then find the code:

    if (!$cookieParams['httponly']) {
        unset($cookieParams['httponly']);
        if (!$cookieParams['secure']) {
            unset($cookieParams['secure']);
            if (!$cookieParams['domain']) {
                unset($cookieParams['domain']);
            }
        }
    }
    
    if (isset($cookieParams['domain'])) {
        $cookieParams['domain'] = $cookie->getDomain();
    }
    
    and comment it out. Or you can add this string just below the above-mentioned code:

    call_user_func_array('session_set_cookie_params', $cookieParams);
    
  4. Save the changes

Clear site cookies in your browser after this operation.

You need to clear the cookies or use the Incognito Mode for this operation