Method to check whether the user is logged in