Yahoo will also provide two years of free credit-monitoring services to people whose data was stolen.