I was working on a multi-feature Drupal site, with many modules installed, and then, just after installing date & calendar, I couldn't access my admin account anymore. I even changed the admin password manually in my db, but it didn't work. I then requested a new password but it kept telling me that the linked had expired. I checked around on the forum but didn't find anything working. Then I did this in my db : UPDATE sessions SET uid =1; and everything went fine... So, the issue seems to be solved for the moment, but I'm still wondering what happened ??? Any suggestion ???

Comments

JamesBecht’s picture

Assigned: Unassigned » JamesBecht
Priority: Normal » Major
Status: Needs work » Active

Access denied again to the admin account today. But this time UPDATE sessions SET uid =1; did not help ! I'm stuck and can't access my website. Help.

JamesBecht’s picture

Status: Active » Needs work

found a possible solution when I followed this issue : http://drupal.org/node/884458

in sites/default/settings.php I changed my $cookie_domain to :

$cookie_domain = $_SERVER['HTTP_HOST'];

and it seems to work.

what is/was the problem in anyway ?

mdupont’s picture

Priority: Major » Normal
Status: Needs work » Fixed
Issue tags: -admin access denied

Cookie was set to the wrong domain, so you were unable to log in (Drupal needs a valid cookie to log you in). Marking as fixed.

zempa’s picture

Hello,
i had the same problem on Drupal 6 and i found that it comes from specifying a node for the "access denied" page.
Actually, the bug occurs only on the admin page http://www.mysite.com/admin.
If you try to log in at the user page http://www.mysite.com/user, it will work.

Then, i've checked the difference between the two forms and i found that the user-login-form in the admin page define the action attribute with the current $_GET['q']. Then if you specify a node called for example "my access denied page" as the "access denied" page, the action attribute will be /my-access-denied-page?q=destination=admin : that's why the authentification fails !

So the solution is to reset the field of the "access denied" page (leave it blank).
If you want to specifiy a page for this "access denied" page, one solution could be, in your template.php theme file :
function mytheme_preprocess_page(&$vars) {
if(!isset($vars['node'])){
$_REQUEST['destination'] = "node/X"; //Where X is the node id of your access denied page.
drupal_goto();
}
}

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.