Ok, seems i need a little help. Is there a way with xojo to prevent a double login (only one user) on the web.
And whats about the user closes the browser without logout ?
Have done a look at the Xojo “Login Example” but here is a multi login (same user) possible.
any suggestions ?
In the Session object create a property with the username. When someone attempts to login you can then call a method that iterates through all of the Sessions and looks at that property. If it’s duplicate, you can give them an appropriate error message.
Now, that doesn’t necessarily work all the time because someone could change browsers and login again and still be legitimate. And the Session won’t close for a certain amount of time after the browser switches to a different web page but that’s the way I’d start looking at it.
Another way to handle it would be to quit any other sessions that the user already started. That way, only the latest one would be valid.
Greg, that’s a clever idea. How would you cycle through the existing
sessions to find that user and quit any previous ones?
You can access all of the sessions using app.sessionCount and app.SessionAtIndex. If you’ve stored the username on the Session object it’ll just be a matter of making a method on the app class that you call with the current username (or account identifier), then loop through the sessions, find the ones that match the current user and call Session.Quit.
Got it. I’m going to start working on that exact thing today. BTW, the web countdown clock that you sent me a little while back is in the system and working. Thanks for your help on that as well!