Perhaps I am overlooking this, but I think an option to have the user register would be a friendly addition to the access denied page. Does anyone know how to activate this feature if it is already included?

Comments

hunmonk’s picture

Assigned: Unassigned » hunmonk

yes, this is a pretty simple thing to add, it looks like. assigning to myself.

webchick’s picture

You'll probably also want to add a "Lost password" link to the login form in addition to "register," or else replicate the tabs that appear on the user_login form.

hunmonk’s picture

i don't think tabs will work here. afaik they are only built from menu items, and we have no way of knowing what page we're going to be on! suggestions?

hunmonk’s picture

after looking at the code and thinking about this a little more, i don't like either the suggestion to add a register link, or the current setup of the access denied page. it seems to me we really ought to let the admin set the message to be displayed in the logintoboggan settings, since sites may have different needs regarding what is displayed here. we can even provide them w/ stuff like %register and %password_reset to allow them to put those links in their custom message. thoughts??

wmswms’s picture

Im also looking for this feature. What I'd like is actually to show people "http://domain.tld/user/", which when not logged in, shows the tabbed page for login/regitser/recover password. I have yet to find a simple way of just redirecting them or changing the module code to include the tabs.

hunmonk’s picture

@wmswms: if you set the 403 page to user at admin/settings, you'll pretty much get the effect you desire. on the downside, there's no access denied message of any kind, but user is directed back to the page they were trying to access after they log in.

for the long term solution to this problem, i'm wondering if it's desirable to just throw a drupal set message about the access being denied, then shoot 'em over to the standard user login page as described above. that would be a very easy fix i think... thoughts are welcome.

wmswms’s picture

Thanks for pointing out what I needed, thats exactly what I need it to do...

As for an access denied message, that seems like it would help so that users dont mysteriously land on the login page if they hit a 403 while logged in. Though when I try to just go to /administer/ on a regular user, I get a sever error about not redirecting properly. Im guessing the redirection to /user/ for someone already logged in causes an infinite redirect? Or is my site just not set quite right?

I think an error message in red above the /user/ page tabs about "access denied" will let them know why they landed at the login page. But I'd want people not logged in to not get the error. My site requires login to view anything, so we just want people not logged in to land on a login page (with register/pass tab) when they try to go anywhere, but not really make it look like an "error". Hope that makes sense.

hunmonk’s picture

Version: 4.7.x-1.x-dev » 7.x-1.x-dev
Status: Active » Fixed

fixed in 4.7 and HEAD, details here:

http://drupal.org/cvs?commit=35385

akaney’s picture

Thank you hunmonk for the patch, but when I uploaded the new cvs, it shows the same thing it did before. Is there something I am doing wrong?

Thanks

hunmonk’s picture

make sure the Present login form on access denied (403): setting is right. you may also need to clear the menu cache, which you can do by visiting admin/menu and editing any item there.

luti’s picture

I've installed the yesterday's 4.7.0 version of module, and found a minor annoyance. As my site is not in English, I've had to include a possibility to localize the message. I've replaced line 668 in the logintoboggan.module:

drupal_set_message('Access denied. You may need to login below...', 'error');

with:

drupal_set_message(t('Access denied. You may need to login below...'), 'error')

hunmonk’s picture

@LUTI: in the future, it would be best if this was opened as a new issue--less confusing that way.

fixed in 4.7 and HEAD.

Anonymous’s picture

Status: Fixed » Closed (fixed)