So if you don't use the user login block, but instead login from the user/login page. After you successfully authenticate with your OpenID provider, you are redirected to the user/login page which presents you with a "Access denied" message. You are, however, actually logged in; you just can't access user/login when you are logged in.

To reproduce:

  1. Go to http://dc2009.drupalcon.org/user/login
  2. login with your OpenID provider
  3. Wait for your OpenID provider to redirect you back to http://dc2009.drupalcon.org/user/login
  4. Weep.
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

gdemet’s picture

I've been able to reproduce this issue on both the Drupalcon DC and Drupalcon Szeged sites, as well as any other Drupal site that I've attempted to login to using OpenID

JohnAlbin’s picture

FileSize
69.12 KB

Here's a screenshot showing:

  1. The URL I've been redirected to after login.
  2. My profile icon and name; which means I really am logged in.
  3. The “Access denied” message in the content area.
Jody Lynn’s picture

This always happened to me on the DC Szeged site too, because their login link goes to user/login (rather than user).

OpenID modules's form_alter sends you back to drupal_get_destination. That's not safe to do upon changing someone's role. Seems better to just redirect to /user.

Jody Lynn’s picture

Status: Active » Needs review
FileSize
862 bytes

Status: Needs review » Needs work

The last submitted patch failed testing.

floretan’s picture

Priority: Normal » Critical

The problem with the patch from #4 is that it always redirects you to http://example.com/user, which is not always what we want. A specific case is when the login URL has a destination specified, like http://example.com/user/login?destination=node/123 (or http://example.com/user/login?destination=user, which I use as a temporary solution), but that destination would be ignored.

However, I do agree that this absolutely needs to be fixed. We can't ship Drupal with an OpenID client that is broken by default.

Also marked #268485: Returns to login page as a duplicate.

mfb’s picture

Status: Needs work » Needs review
FileSize
1.18 KB

The attached patch fixes the issue in openid.module.

By the way, my initial thought was that it would be nice to redirect the user/login page to the user page for authenticated users, but I'm not sure how to do this when we have to deny access so users don't see a "Log in" menu item. We would need some way to deny access and redirect to another page.

mfb’s picture

oops. Removed an extra blank line.

Jody Lynn’s picture

Status: Needs review » Reviewed & tested by the community

This looks good.

Dries’s picture

This looks good to me. Wouldn't it be better to make this a generic function in user.module so that it can be reused by other authentication modules? Probably not very important, but could be helpful.

mfb’s picture

Status: Reviewed & tested by the community » Needs review
FileSize
1.59 KB

Changed openid_get_destination() to user_login_destination()

Francewhoa’s picture

Status: Fixed » Reviewed & tested by the community
FileSize
101.84 KB
52.3 KB
106.07 KB
43.73 KB
38.45 KB

Confirming that patch in #11 works. Thanks mfb

I tested the following.
-Login with OpenID on a fresh Drupal site without content.
-Login with OpenID on a fresh Drupal site with content. Destination node/1
-Simulating user error by trying to log-in with wrong OpenID URL.

Tested with.
-Drupal 7 (September 9, 2009 - 05:11) fresh install.
-Garland theme.
-Windows XP
-Internet Explorer 7

webchick’s picture

Status: Needs review » Fixed

Committed to HEAD. Thanks!

sun’s picture

Status: Reviewed & tested by the community » Needs work

No tests.

mfb was so kind to not-really-point-me-here, but mention this addition in #578520: Make $query in url() only accept an array. ;)

sun’s picture

Issue tags: +Needs tests

Tagging.

mfb’s picture

Status: Needs work » Needs review
FileSize
1.15 KB

added user/login test to the existing openid login test.

Francewhoa’s picture

@all: What are 'tests'? I read that on a few issue queues. Could you give me link(s) where I could read more about what tests are? Does 'tests' means tests for the 'SimpleTest' module or Drupal automated patch testing output as 'Testbed results'? Or something else? Thanks.

floretan’s picture

Status: Needs review » Reviewed & tested by the community

@Onopoc: by "tests" we mean automated tests written for the Drupal SimpleTest module (in core since Drupal 7). You can find more info here: http://drupal.org/simpletest

The test addition looks good to me.

Francewhoa’s picture

Thanks flobruit

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Thanks for the tests! Committed to HEAD.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

zyxware’s picture

Version: 7.x-dev » 6.15
Status: Closed (fixed) » Active
FileSize
1.31 KB

The same issue exists in Drupal 6.15. I have reworked the patch for Drupal 6.15 and am attaching it here.

jcisio’s picture

Version: 6.15 » 6.16
Status: Active » Reviewed & tested by the community

6.16 is out and this wasn't fixed :(

Gábor Hojtsy’s picture

Who tested this besides frowning that it is not in release yet?

sun’s picture

Status: Reviewed & tested by the community » Needs review
old_kking’s picture

subscribed.

nilsja’s picture

i also get redirected to domain.com/user where again the login form is displayed. but without access denied. i'm just not logged in.

i dont understand why this is happening. when i login without openid i am also redirected to /user but logged in!

before i try the patch: do you think it would help in my case? running 6.16...

it could also be related to a session variable problem: http://drupal.org/node/223194

apaderno’s picture

i also get redirected to domain.com/user where again the login form is displayed.

That happens to me when the server handling the OpenID account returns something that Drupal is not able to understand, or that understands to be an error.

nilsja’s picture

@kiamlaluno, the strange thing is that on other drupal installations it works fine. and the openid provider i am using is also a drupal with openid provider module...

paul.lovvik’s picture

Status: Needs work » Needs review
FileSize
1.82 KB

I tested this change and it does address the issue. The code looks good except I don't think the function that figures out the login destination should go into the user module. It seems like this is the only known usage, and likely the only code that should use it. That being the case, I did a minor reroll of the patch to move this functionality into the openid module and refactored the comment a bit.

Please disregard this patch

Version: 6.16 » 6.17
Status: Needs review » Needs work

The last submitted patch, 365597_30.patch, failed testing.

paul.lovvik’s picture

Status: Needs review » Reviewed & tested by the community

The patch in http://drupal.org/node/365597#comment-2542070 was the basis of the patch I just posted and I new see that I have undone the work suggested in comment #10. Sorry about that. I did test the previous patch and the code is fine as is, and it solves my customer's issue.

Gábor Hojtsy’s picture

Status: Reviewed & tested by the community » Needs work

Can we get your docs additions from this last patch but keep the user_*() function space addition as in the previous patch?

paul.lovvik’s picture

Status: Needs work » Needs review
FileSize
2.04 KB

Absolutely. Here is the new patch. #22 with the comment from #30. i verified the patch locally.

ksenzee’s picture

Status: Needs review » Reviewed & tested by the community

Looks great.

Gábor Hojtsy’s picture

Status: Reviewed & tested by the community » Fixed

Looks great, especially glad for the testing feedback; committed.

Status: Fixed » Closed (fixed)
Issue tags: -Needs tests

Automatically closed -- issue fixed for 2 weeks with no activity.