Here’s my problem. The user still has the app running, however he’s logged out due to 15 minutes inactivity by my Backend app (separate app).
When the user is using the app again, it rightfully triggers a resume event that is captured in Accounts.validateLoginAttempt in the server code of my frontend app.
I’m returning false for this login attempt and it should therefore bring the user back to the login modal. However, it doesn’t happen and the user ends up with an unresponsive app (apart from forcing a refresh by CTRL-R) as his connection to the Backend server is cut and the app still believes that there’s a connection. So no reactive data changes are received.
I’ve tried setting 'status.online': false but to no avail.
resume condition is identified through options.allowed === false and options.user === undefined.
Sending an event/msg to the frontend from the backend is a general problem, how do you solve this in general? The only option I see is to throw a Meteor.Error which isn’t the nicest way.
If you’re returning false from the validateLoginAttempt, it should be logging the user out. Perhaps you need to pair it with a Meteor.onLogout function running in the client to redirect the user to the login modal on the logout event.
Thanks for your comment. I suspect there’s some other code that overrides that behavior but I’m not sure where to look for (please note that I’m trying to fix a former employees frontend code and I’m still learning frontend).
It might be in the routes.js file - there’s one likely candidate in a code block that redirects a lot of calls to home “/“ to a different route. Also need to check if it actually enters any other part of FlowRouter instead of going to the Accounts modal sign-in
If you type Meteor.userId() in the browser console after the user should be logged out, does it come back as null? If so, the user is logged out and it is just a client-side routing issue, in which case, yes, you might have to dig through the FlowRouter routes and global triggers.
If you add something like this in the client side code, assuming there is no other weirdness going on, it should work.