For theme purposes it would be great for LoginTobagan to redirect all Access Denied to /user/login

The Idea is to redirect people to the path /user/login so that a unified block configuration can be assigned to the login screen. A Querry String can be used to redirect the user to the page if the access is available.

This has a few benifits. For SEO perposes it unifies the page to one location. It also can create a unique user configuration for all user login requests. It also allows us to setup a unified block setup that can describe the site, its benifits and login/registration help.

Comments

xibun’s picture

I have recently upgraded Drupal from 6.10 to 6.12 and LoginToboggan from 1.3 to 1.5 (and some other modules).

Before the users used to be redirected to a login screen formated in the site theme.
Now the users get redirected to a login screen formated in the administration theme.

I haven't yet identified what made that change - but above suggestion should fix it.

hunmonk’s picture

i would consider this for 7.x, but somebody will need to step up with a good patch. :)

@xibun: sounds like an issue with your upgrade, not with LT.

hunmonk’s picture

please see http://drupal.org/project/logintoboggan#commitment for more information on how task/feature requests are handled in the module

geek-merlin’s picture

Status: Active » Needs review
StatusFileSize
new4.91 KB

having a unified login page without being able to use it, i consider a bug.

needed this for a project so kindly stepping up with a good patch(tm).

additionally
* user can choose between "user/login" and "user/register" to redirect to
* privides a fallback setting for authenticated 403 page

geek-merlin’s picture

this improvemed version
* cleans its variable up on uninstall
* redirects you back to where you came from after login/register

j0rd’s picture

This is the exact patch I need. For my site, I wanted to redirect to "user/register" instead of "user/login" on 403.

I'm using this to lazy'ly do a redirect from node/add/content if the user does not have access to create the content.

I'd recommend this patch for consideration into the next version of logintoboggan. Works as expected.

+1

skclewis’s picture

I'm a newbie at some of this. Where do I install the patch? From the thread it seems this patch will fix a situation I am facing with a site I am developing. I'm not a coder per se so for things like this I need a little extra help. I know enough to get the job done and possibly be dangerous . :) thanks!!

hunmonk’s picture

Status: Needs review » Needs work
  1. patch no longer applies
  2. +  if($anon_403 == '0') $anon_403 ='';
    +  if($anon_403) variable_set('site_403', 'toboggan/denied');

    not up to coding standards, should use brackets

  3. i don't like the removal of logintoboggan_page_alter(), i believe removing the blocks on access denied is a good thing.
  4. in general, not sure if i like this approach over the current one. you don't need a redirect now and you still end up on the page you originally intended.
  5. some of the problem here has been solved by #1172652: Show unified login on Access Denied
ayalon’s picture

StatusFileSize
new4.89 KB

Unfortunately you are not right hunmonk.

If you build your page with panels, it is necessary that the user is redirected to "user/login" to display the theme an the correct blocks on this page. Therefore, this patch make a lot of sense.

I updated the patch to the latest version 7.13.

attiks’s picture

Status: Needs work » Reviewed & tested by the community
StatusFileSize
new5.01 KB

There're some whitespace issues in the patch, but it works, nice work

Reroll for whitespace issues

corbacho’s picture

Issue summary: View changes

Patch #10 still applies to 7.x-1.4. Works as advertised. :)
This should go in!

nwom’s picture

Works great. Thank you. The only problem I have now, is the language on the login page is always changed to the site's default language. Not sure if this is a problem with the patch, or i18n.

vacilando’s picture

Title: Redirect on Access Denied to /users/login » Redirect on Access Denied to /user/login

Btw, this functionality adds the same that https://www.drupal.org/project/r4032login already provides. Of course, some people will like to use it in the context of LT, others (those not needing LT) may choose the more specialized module.
It will be good to mention that in the documentation and perhaps let the maintainer of r4032login know as well.

Also, correcting a typo in the title of this issue ("/user/login" instead of "/users/login").

  • attiks authored 6662898 on 7.x-1.x
    Issue #465390 by geek-merlin, ayalon, attiks: Redirect on Access Denied...
stevecowie’s picture

Status: Reviewed & tested by the community » Fixed

Tested, approved and pushed. Great work and apologies for the extended delay. Hoping to get this from dev to a stable release within the next week.

stevecowie’s picture

Status: Fixed » Closed (fixed)
blasthaus’s picture

Does the above patch have a typo in the logintoboggan_denied() ?

<?php
$return = t('You are not authorized to access this page.');
// instead of return t('You are not authorized to access this page.');
?>
stevecowie’s picture

You could well be right. As it happens, I'm making some changes to how the redirect on 403 works because this patch broke another approach, so I'll investigate the return behaviour when I'm doing that. Thanks.