Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is my Drupal site logging out users when a Javascript function is called?

I have Drupal 5 site where a button is clicked and it calls a JavaScript function. The function basically builds a string, and then redirects to another page on our site. After clicking the button, sometimes the user gets logged out and sees the "Access Denied" screen, even though they were previously logged in. The page where they are being redirected has the same access restrictions as the previous page, but regardless of that, they shouldn't be getting logged out.

One user has this happen about half the time (the other half it works as it should), and another user has reported always being logged out when clicking that button. However, I'm always able to run it without a hitch on the machines I use, and I suspect it has to do with them using IE6. Has anyone run across this issue before, or have any ideas on what could be causing this? I've searched and posted in the Drupal forum, and searched in this forum, and have had no luck yet.

like image 643
Pamela Avatar asked May 06 '26 09:05

Pamela


2 Answers

Many things come to mind.

  • Is the page being redirected to on the same domain? domain.com and www.domain.com are NOT the same as far as cookies are concerned (depending on how they are set)..
  • Can you reproduce it 100% reliably in any browser? No offense to your users, but users are liars (or at least bad at reporting technical bugs). I wouldn't trust something a user told me as fact ("oh, well, yeah, I was closing the browser between tries. but that shouldn't matter.").
  • Is there something running on the server that is clearing out session, or is the session expiration limit set too loo?

Moral: go try and reproduce the issue first, so you can narrow down exactly what it is. I suggest Firebug + Firecookie for debugging Firefox and general cookie problems, and Fiddler2 (a proxy) for debugging IE.

like image 175
gregmac Avatar answered May 09 '26 23:05

gregmac


I think to be honest, the best way would be to post the code that's causing this.

Drupal uses PHP sessions to do this, which use cookies... do any of the users have cookies switched off?

There are many things that can be causing this, redirecting do a different domain, something clearing out the sessions (/tmp cleanup?), but usually, I'd put something like this down to the browser.

Ask them if they can still reproduce using another browser (try firefox)... check their cookie security settings, and more.

like image 23
Mez Avatar answered May 09 '26 23:05

Mez



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!