Joe Posted April 3, 2014 Share Posted April 3, 2014 Is it possible to block another user from logging in when someone else is logged in already?The reason I am asking this: I'm setting up a test site for prospective clients. I have arranged it so the site gets set back to the original state every time someone logs in (DB gets restored from a backup copy). If someone else tries to log in at the same time though, things get messed up and have to reset things manually.So I would like to make it impossible to log in if someone else is logged in already and show a message to that effect. My problem is I haven't figured out how to detect if another user is logged in before logging in. (I am using the PageEditSoftLock module, but for this it is not the right thing, even with the hard lock turned on. I need to keep other users from logging in, not just from editing pages.) Link to comment Share on other sites More sharing options...
Martijn Geerts Posted April 3, 2014 Share Posted April 3, 2014 It's a bit related and not solving your problem. I had to build a module for a customer, who needed a translation company browse the backend, but don't allow them to edit anything. ( configured at role level ) module: conditional demo mode in the settings you c an add the roles 1 Link to comment Share on other sites More sharing options...
Joe Posted April 3, 2014 Author Share Posted April 3, 2014 Hi Martijn, that looks interesting and I may try to use it in another context: To allow people to test anonymously with a "test" user name and password. They could test a little, but without being able to save. I suppose that should be secure enough. 1 Link to comment Share on other sites More sharing options...
Wanze Posted April 4, 2014 Share Posted April 4, 2014 Hi Joe, See here: https://processwire.com/talk/topic/4553-how-do-i-get-a-list-of-online-users/ It should be possible to get a list of online users. You then need a Hook for example on this method: https://github.com/ryancramerdesign/ProcessWire/blob/dev/wire/core/Session.php#L311 Return false if there is already a user logged in. Link to comment Share on other sites More sharing options...
kongondo Posted April 4, 2014 Share Posted April 4, 2014 Actually, it seems Joe was the last poster (13 November 2013) in that thread Wanze points to 1 Link to comment Share on other sites More sharing options...
Wanze Posted April 4, 2014 Share Posted April 4, 2014 Actually, it seems Joe was the last poster (13 November 2013) in that thread Wanze points to If we add a link in the pointed thread to this one, we'll get recursion 3 Link to comment Share on other sites More sharing options...
kongondo Posted April 4, 2014 Share Posted April 4, 2014 As long as it's not an infinite loop..... Link to comment Share on other sites More sharing options...
Joe Posted April 4, 2014 Author Share Posted April 4, 2014 If we add a link in the pointed thread to this one, we'll get recursion As long as it's not an infinite loop..... Yeah, right. I was aware of that post, but when I had tried I could not get the list to work. I will check it out again though and also look at Wanze's link. Thanks. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now