web single login (only one user)

  1. 3 years ago

    Hi all,

    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 ?

    Thanks, Mike

  2. Bob K

    23 Dec 2014 Pre-Release Testers, Xojo Pro Kansas City

    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.

  3. Greg O

    23 Dec 2014 Xojo Inc Somewhere near Raleigh, NC

    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.

  4. 4 months ago

    Peter S

    Aug 10 Pre-Release Testers, Xojo Pro Huntsville, AL

    Greg, that's a clever idea. How would you cycle through the existing
    sessions to find that user and quit any previous ones?

  5. Greg O

    Aug 10 Xojo Inc Somewhere near Raleigh, NC

    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.

  6. Peter S

    Aug 11 Pre-Release Testers, Xojo Pro Huntsville, AL

    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!

or Sign Up to reply!