I am trying to use this module in place of ip_authenticator which (like core drupal) blocks authenticated (and ip_authenticated) users and admin from accessing pages typically only used by anonymous users, specifically:
user/login
user/register
Is it possible to make a "switch user" link or a login link or a register link for authenticated users?
I use ip_authenticator to automatically log in visitors from computers WITHIN our corporate facilities to our intranet. So anyone sitting down at a terminal in our hospitals sees the site which is not seen by the rest of the world. These users, however, each have individual accounts which they need to log into from the same terminal. They also need to be able to register for a new account.
Any help would be greatly appreciated.
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | ip_login.patch | 2.75 KB | pluess |
Comments
Comment #1
davidbessler commentedNo takers?
Comment #2
davidwhthomas commentedhmm, tempted to mark as "won't fix" since this module is designed to keep users logged in according to their IP address.
however, that use case is a possibility - where users need IP login at a terminal _and_ another separate user account...
Unfortunately, I don't have time to work on a patch myself, but patches are welcome.
I'd suggest setting a $_SESSION variable ( e.g manual login ) at some point and checking that prior to authenticating them by IP address.
DT
Comment #3
davidwhthomas commentedComment #4
davidbessler commentedThanks. I will research that variable and see if I can get something started.
Comment #5
pluess commentedIs someone busy with this? I'm ready to create the patch but like to avoid duplicated work.
Comment #6
pluess commentedHere's the patch. It adds a "Login as a different user" link to the navigation in case you're logged in by the ip_login module.
Comment #7
davidbessler commentedApplied patch. Seems to be working as expected. Thanks SO much for doing this! This patch seems to provide the functionality of allowing new registration as well. I will be adding another link called "Register," since for my purposes, this is the main reason I needed this patch.
Comment #8
davidbessler commentedIs there a way to reactivate the IP login again after I click the log out button? If my users click the new link but they don't have a username, they need to be able to get back into the account which was logged in by IP. Does that make sense?
Comment #9
davidbessler commentedPlease respond to this. Can you create a link which, when clicked, requests that the system try to authenticate by IP again. If an IP Authenticated user is logged in, then clicks "log in as a different user" accidentally, there is no way for that person to log back in by IP. My users are anonymous users who don't have a username and password. A link entitled, "Try to log me in by IP" would be great.
Comment #10
pluess commentedI'm going to have this problem with one of our customers as well. Will fix this, but it may take a weak or two, since I'm very busy currently.
Comment #11
davidwhthomas commentedLooks like it needs a link with a callback to clear the $_SESSION variables
LOGIN_AS_DIFFERENT_USER and
ip_login_complete
DT
P.S Would be nice if the two session vars followed the same naming convention.
Comment #12
davidbessler commentedCan you help me with this? Right now people in my facilities have to find someone with a login to login and then log out to "reset" the ip_login.
Comment #13
generalelektrix commentedI need the same functionnality, Some users will click Login as different user and then they are stuck if they don't have an account. I need a way to log them back by IP address. Thanks.
Comment #14
generalelektrix commentedI worked something out.
Added this menu callback to the ip_login_menu() function:
And then added these two functions:
Then, I just added a link to /ip_login_back somewhere in my site and it worked like a charm!
Please let me know if you see any issue with this way of solving the problem.
Comment #15
davidbessler commentedThat seems to work perfectly! I just put that link on my access denied page "Try to [login by ip address]." Can somebody check to make sure this is secure?
Comment #16
generalelektrix commentedThe only doubt I have is with the ip_login_alwaystrue() function, but I don't see a reason why this menu callback would need to be restricted access. Maybe it could be disabled by returning false when a user is already logged in by IP. Anyway, I think the call to ip_login_login would have no effect with a user already logged in by IP. I have made sure that the link to /ip_login_back is only available to anonymous users, so it's not something that stresses me much.
Comment #17
jim kirkpatrick commentedHi, I've integrated the patch by pluess (THANKS!) and further suggestions by davidbessler and generalelektrix 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.
Comment #18
jim kirkpatrick commented