Needs work
Project:
Login Disable
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
22 Mar 2011 at 19:03 UTC
Updated:
14 Mar 2019 at 12:53 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
berliner commentedOk, I tested this, and logged in users stay logged in until they log out.
I would suggest two things:
1. Add an option to log out users once the login is disabled
2. Integrate the module options into the maintenance settings. Semantically it is there that maintenance is handled.
You could even add your modules functionality to the maintenance options (online / offline / logout users and prevent login). That way site admins can choose depending on the maintenance tasks that are going to be executed. E.g. for pure content related modifications to a site where the code and database structure is not affected, a login prevention is sufficient, where as other tasks would require a deeper maintenance status, so that php or database errors won't be displayed.
Comment #2
buddaI was considering truncating the sessions table to log out everyone - or maybe everyone except user id 1?
Thanks for the suggestion on the maintenance page. Good idea!
Comment #3
lhugg commentedHas a decision been made on whether an option will be added to log out currently logged-in users? This is a great module, but I was surprised to find it wasn't really doing what I THOUGHT it was doing when I noticed users logging into the site where that I thought was disabled. Drupal typically maintains sessions for weeks unless a user logs out, so truncating the session table might be a great option.
What is the status of this request?
Comment #4
Letharion commentedComment #5
gisleI think this is an undesireable feature, so I am reverting the state to "support request" (and suggest that it is closed as "closed (won't fix)" - but I'll leave that call to the maintainer.
As for logging out all logged in users, just set your site to maintenance mode (this will automatically gracefully log out all logged-in users except the admin). Then enable Login Disable and revert from maintenance mode.
My use case for Login Disable requires logged in users to stay logged in - I just don't want any new user to be able to log in. So I see no need for this feature. And if you need it, just popping in and out of maintenance mode will do it.
Comment #6
berliner commentedSetting back to feature request as that is what it actually is.
@Budda: If you need a hand, just say so.
Comment #7
damienmckennaProbably the best solution would be a Form API submission callback on the settings page, so that when the functionality is enabled it deletes sessions except for the current user.
Comment #8
budda@berliner open to a patch submission for this as i've not got time to work on new features at present but happy to review / tests - as others here maybe too.
Comment #9
gisleIf you implement this "feature", make sure there is an option to disable it.
I am currently using this module to disable new logins but letting logged in users finish their business in a graceful manner (before moving on to maintenance mode). If this "feature" is implemented without a way to disable it, my use case will break.
Comment #10
damienmckenna@gisle: I think the idea would be for it to be a one-time thing - any user who was not supposed to be logged in anymore (based on permission) would be logged out.
Comment #11
Leeteq commented@DamienMcKenna: what does "not supposed" mean in this case? How to reliably identify them and make sure others are not logged out?
I agree with @gisle in that this should at least be made optional in the admin interface, so that both use cases are covered.
Comment #12
abarpetia commentedHello,
This is old request but I think it will be worth to have this feature. I agree with @gisle regarding option to disable this feature. Here is the patch which is adding option field into module's configuration page and based on this field value it deleting sessions of all logged in users except current user and User 1.
Please take a look at this patch.
Comment #13
mortona2k commentedGreat patch! I verified that it worked, and I would accept it as is, with some recommendations for future work. I see this module being useful for D8.
It would be good only logout users without permission. If this was used in some scenarios, it may have disruptive effects for sensitive users.
Post the configured message after they're logged out, so they know what's going on.
Comment #14
alfaguru commentedI don't think truncating the session table is the right way to go for two reasons.
So I would suggest the following alternative logic (pseudo-code), in a hook_init.
Comment #15
baikho commentedThere's a small typo in the patch:
should be "When active all the logged in users will be forced to logout." (omit 1 g from "loggout")