Added method for checking if a user is logged in.