How to check whether a user (not current User) has active logged in session or not
The AuthSession object keeps each non-guest user session in your organization. Here is full detail of object: https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_authsession.htm Check the size of auth if it’s greater than zero and IsCurrent is true then session is active otherwise not.