If you:

  • Log in
  • do stuff
  • Log out
  • do more stuff
  • hit the back button a bunch -- you appear to be logged in due to pages being cached
  • Press log out again, since you look like you're logged in

Instead of getting a message that you're [already] logged out, which is what one might expect, you instead are presented with a terse and somewhat scary-looking "Access Denied: You are not authorized to access this page."

It seems like this could be improved by something as simple as adding a:

if (!$user->uid)
   drupal_goto();

to the beginning of user_logout()

CommentFileSizeAuthor
#3 user_47.patch126 bytesfalcon9xr
#1 menu_23.patch250 bytesfalcon9xr

Comments

falcon9xr’s picture

StatusFileSize
new250 bytes

I wrote a patch (attached) that will solve this. It modifies the "includes/menu.inc" file. It isn't the cleanest way to do it, but it works, is simple, and doesn't seem to break anything. Be sure to disable and enable caching after applying it, as I encountered trouble during testing with the caching. Let me know if I missed something huge that it causes to break.

I did try putting the
if (!user->uid) {
drupal_goto();
}
in the user_logout() function, but the function doesn't seem to be called by an anonymous user at all.

falcon9xr’s picture

Oops, dont' use the patch. It redirects infinitely. I'll rewrite and post up the new patch. Sorry!

falcon9xr’s picture

StatusFileSize
new126 bytes

Ok here is another patch file. It edits the "modules/user.module" file. If the previous patch was applied, please remove it. This patch file has one downside, anonymous users will be able to see the "logout" option on the menu. I haven't quite figured out how to remove that yet.

moshe weitzman’s picture

Status: Active » Closed (won't fix)
Wesley Tanaka’s picture

Status: Closed (won't fix) » Needs work

Getting rid of it in the menu should be as simple as setting the 'type' of the callback to 'MENU_CALLBACK' if !$uid

magico’s picture

Status: Needs work » Closed (fixed)