"Is logged in/logged out" parameter in backend workflows

Hi, I’m trying to do something supposedly simple.

If the user is logged out, then the field “2FA valid = no”.

I have done this front end on the logout button (when clicks logout make change to user, field 2fa valid = no).

But 90% of users are logged out automatically by bublble at some point.

So the field 2FA valid stays yes.

I wanted to implement a backend workflow that does “user logged out? ok the turn 2fa valid field to No”.

But this isn’t apparently possible.

Database trigger either doesn’t have a setting like user before changed is logged in or logged out.

I don’t see any way to do this simply (there’s no field . Chatgpt only suggests overcomplicated solutions that aren’t really applicable because they always assume there’s a way to capture that user is automatically logged out, which is not the case.

Any simple solution here? thanks!

1 Like

Out the back of my head. How about you save current date in some field when the user logs in. And Data trigger if this field is changed do something.

Hi @tris, I might be totally off here but trying to think through your issue,

If Bubble automatically logs users out at some point, wouldn’t it be better to check periodically for logged out state then set the 2fa based on that instead of a backend trigger?

So I’m thinking frontend workflow > general > user logged out > make changes to user > 2fa valid = No

or

general > do when condition is true > only when current user is logged out > make changes to user > 2fa valid = No

I think with this you might not even need to make changes to user on click of the logout button since it would trigger automatically when the user is logged out either by bubble or by clicking the logout button.

Please let me know if this helped at all.

Goodluck