Checking session existence with interceptor

Good morning everybody.

I’m new to cf and coldbox and would like to know the best way to check if the session exists so I can call the logout screen.
I checked by creating an interceptor function preProcess but, as I make calls to events via jquery, it seems that it does not comply.
Where can I check assertively so that the user is redirected.
Grateful

If session management is enabled, the session scope will always “exist”. I assume you are looking for some specific variable you’ve set in the session scope which marks the user as logged in?

Also, by call the logout screen, I assume you mean redirect the user’s browser to a page that says they’re logged out and offers for them to log back in?

This seems reasonable.

I’m not sure what you mean. I think perhaps you’re saying a 302 redirect in response to an Ajax request does not produce the desired result. You’ll need to build your interceptor to check and see if the request is Ajax and return a status code or response which the browser checks for on every ajax call to see if the call was successful, or if the user is actually not logged in. Then you can handle it from the front end.

You’re checking in the correct place, you just need to customize exactly what your interceptor does based on whether the request is ajax or not.