I don't know if this is a bug or by design, but on the "access denied" page that is displayed does not show any menus. Is there a reason for this? Any way to work around it?
I don't know if this is a bug or by design, but on the "access denied" page that is displayed does not show any menus. Is there a reason for this? Any way to work around it?
Comments
Comment #1
adamo commentedI have an idea. Currently it looks like during init this module checks for possible hijack attempts, and if it finds one it outputs the basic error page, destroys the session, and then exits.
Instead of doing it that way, how about we log out the user, set current user to anonymous, and then redirect (drupal_goto) to a page explaining why they have been logged out, and then present them with the login form on that page so they can just enter their username and password to continue.
By setting the user to anonymous and then redirecting with drupal_goto, the user will arrive at a completely functional page (with menu's intact, etc), rather than one that appears to be broken. Thoughts?
Comment #2
adamo commentedI've done the above on my site and it works well. Instead of being presented with a broken page (no menus, javascript missing, etc) with a link to the log in page, users are presented with a complete page including a login form. Then enter their username and password and it logs them in and brings them to the page they were trying to access.
Here is the modified securepages_prevent_hijack_init() function:
And for the actual error page:
Another advantage of doing it this way is that site developers can use hook_menu_alter() to replace the default page with whatever they want.
Comment #3
grendzy commentedThis is fixed in http://drupal.org/cvs?commit=363710 though with a different approach, it now uses the standard drupal_access_denied(). This should bring back the blocks, and also means you can set custom error pages at /admin/settings/error-reporting, or use modules like customerror to display whatever you want.
Comment #4
adamo commentedAwesome! :)