Hi there,

I notice that after I set up an IP login, when I go to www.mysite.com I'm not logged in. It's not until after I click a link, ie, another page loads after the front page, that i'm logged in.

Has this got something to do with caching? Is there anything I can do about this?

Cheers!

CommentFileSizeAuthor
#3 ip_login_hook_boot.patch6.57 KBdeekayen

Comments

deekayen’s picture

I believe this might be related to issues with browser cookie implementation. The first cookie is sent at the start of the page request and the system hasn't yet processed the login status. It takes another page load for the system to recognize after the login because the client didn't have the cookie on the first page load to send.

deekayen’s picture

Actually, it might have to do with the use of hook_init() instead of hook_boot()

http://api.drupal.org/api/function/hook_init/6

hook_init() doesn't run on cached pages, so if the first page you loaded was cached, it wouldn't even attempt to authenticate you. I'm sure it's just a missed update from 5.x to 6.x where hook_boot() was first introduced and the behavior of hook_init() changed.

deekayen’s picture

Status: Active » Needs review
StatusFileSize
new6.57 KB

This patch switches to hook_boot() and conforms to Coder analysis at the minor level.

tripper54’s picture

Hi there,

So is this just a matter of renaming the ip_login_init() function to ip_login_boot()?

I tried that and it seems the login function check doesn't get called at all.

I don't want to apply your patch as I'm already running a modified version of the module (see http://drupal.org/node/352102 ).

deekayen’s picture

Status: Needs review » Needs work

I think it ought to be during boot, which means you should be able to rename the function, but I'm not sure if all the functions in the init version are available that early in the bootstrap (like ip_address()). I guess that's my fault for uploading a dirty patch - I should have split the Coder part out as a separate submission.

jim kirkpatrick’s picture

Hi, I've included deekayen's suggestions into a new, more flexible version - please see #791410: Improved: now supports logging in as alternate user plus comma separated values, IP ranges and wildcards for more.

jim kirkpatrick’s picture

Status: Needs work » Closed (fixed)