checks if user is already logged in on loading page