Any elegant workflow for preventing simultaneous logins?

Looking for good workflow ideas about how to simply prevent a user from logging in from multiple locations at the same time.

Thanks,
Dan

1 Like

I’m not sure completely but I would think a simple only when to your login workflow could work. Something like…

When button login is pressed -> log user in (only when current user is not logged in) -> navigate -> go to page (sign in redirect)

Could also create a lookup table with a login record and then check for this on login and delete the record on logout.

Check settings. I am pretty sure there is something there to restrict multiple logins.

There is a workflow option “log out the user’s other sessions”. I put this step in my login workflow, so that when the user logs in, any other logged in sessions for that user gets logged out. This seemed the simplest way.

4 Likes

Is there a way to throw an alert or page redirect when one instance is logged out because another logs in elsewhere? I’ve tried the following simple workflow and nothing obvious seems to happen. I’m logging in on two separate computers in the office with the same credentials and they both appear to continue to run.

Try reversing step 2 and step 3. User needs to be logged in in order for Bubble to know which user it’s logging out of other sessions.

1 Like

Thanks. I reversed that and it seemed to help. I also set “Stay Logged In” to NO.

However, nothing obvious happens when the user is logged out because someone else logged in, except that all of my repeating group’s data go blank if I click on anything. Then it throws an error…

Clearly the app becomes disabled due to the subsequent log in, but it just looks like the app is failing due to some error.

There must be some elegant simple solution to where the user can be shown a pop up or a page redirect that lets them know they have been logged out. And it should be relatively immediate.

I haven’t run into this error message, but I’ve done a couple of additional things in my setup…

  • All my pages that require client login to see have a redirect on them (a workflow “When user is…” so that if a user is logged out it navigates to the home page).

  • All content on those pages is within a group that has a condition on it so that it’s only visible if the user is logged in.

  • The above prevents a logged out user from interacting with anything on pages where they aren’t supposed to be.

But if you are really wanting to do a notification, then put a popup or group on the page that says “you are logged out”. This would then appear whenever the user is not logged in.

One thing I did do with this app is to create an activity detector which will automatically log a user out if there is inactivity for X amount of time. In my case I set it for 10 minutes and at 9 minutes it displays a popup that says “Are you still there?” explaining that they will be logged out in 1 minute if they don’t click something. It also displays a big countdown timer during that time.

This topic was automatically closed after 70 days. New replies are no longer allowed.