(CNN) Senators on Wednesday warned that the Trump administration — and President Donald Trump himself — are not doing enough to prepare for the cybersecurity threat to election systems in this year's midterms.

Senators from both parties knocked the Trump administration for not working quickly enough on election security in advance of the upcoming election season, while also questioning the missteps that occurred during the Obama administration's response to Russian hacking in the 2016 election.

"I hear no sense of urgency to really get on top of this issue," Sen. Susan Collins, a Maine Republican, said at a Senate Intelligence Committee hearing on election security.

Both homeland security secretary Kirstjen Nielsen and former department head Jeh Johnson testified before the committee Wednesday, one day after the panel issued a list of recommendations to bolster election security at the state and federal levels. The rare appearance of both the current and former secretaries gave lawmakers the chance to probe the government's response across administrations.

Nielsen told lawmakers that the 2018 midterms and future elections are "clearly potential targets for Russian hacking attempts," but she argued that her department has made key strides to prepare states to combat hacking.

Nielsen said DHS has improved information sharing with states and has expanded its assistance for cybersecurity risk assessments to the states. States can now have three election officials with security clearances to receive classified information, and DHS provides "one day read-ins" about threats for senior officials.

"We know whom to contact in every state to share threat information," Nielsen said. "That capability did not exist in 2016."

But Collins argued that wasn't fast enough. She said she was "dismayed" that no officials had received a security clearance eight months after the 2016 elections, and she pressed Nielsen on how many election officials had actually received them to this point.

Nielsen said 20 state officials — out of a possible 150 — had received clearances to date, saying they were working with other agencies to speed up the process.

Virginia Sen. Mark Warner, the top Democrat on the committee, said that the Obama administration and states were "caught flat-footed" during the 2016 election, failing to notify the states about the threat until fall 2016.

And he said the initial response under the Trump administration wasn't much better — specifically criticizing Trump for failing to acknowledge the threat posed by Russia.

"The threat is real; the need to act is urgent," Warner said. "Perhaps most of all, we need a President who will acknowledge the gravity of this threat, and lead a whole of society effort to harden our defenses and inoculate our society against Russia's malicious interference."

Warner said it was "extremely troubling" that Trump did not bring up election security when he called Russian President Vladimir Putin this week and congratulated him on his election victory.

Sen. Dianne Feinstein, a California Democrat, questioned why DHS wasn't notifying the public when state election systems are attacked, rather than leaving that decision up to the states themselves.

"America's the victim. And Americans have to know what's wrong," Feinstein said. "And if there are states that have been attacked, America has to know what's wrong. So this victim answer with me has no credibility at all."

Nielsen argued that states work with the federal government on a voluntary basis, and they will only continue to do so if they trust DHS. "When it comes to this situation, the victims stop reporting" she said.

Feinstein also slammed the Obama administration's response to election hacking during 2016.

"I don't understand, you learned about this in August," Feinstein asked Johnson. "You did a number of specific things, you spoke about the dates that you did these things, and yet the American people were never told. Why?"

"Well senator, the American people were told," Johnson said.

"Not sufficiently in any way, shape, or form to know that there was a major active measure going on, perhaps by a foreign power," Feinstein shot back.

Johnson, who was President Barack Obama's DHS secretary during the 2016 election, said that the Obama administration blamed Russian officials in October 2016 for election hacking, although he said they could not attribute the hacking to the Russian government at that point.

Johnson also said that the states were to blame in part for the lack of a proper response to Russian hacking. In August 2016, Johnson said, he told the state election officials that he wanted to offer DHS assistance in securing their election infrastructure, and he wanted to designate election systems as "critical infrastructure" for the federal government.

But he said the state reaction on a conference call with state officials "was neutral to negative."

"Those who expressed negative views stated that running elections in this country was the sovereign and exclusive responsibility of the states, and they did not want federal intrusion, a federal takeover, or federal regulation of that process," Johnson said in his opening statement. "This was a profound misunderstanding of what a critical infrastructure designation would mean, which I tried to clarify for them."

As a result, Johnson said, the federal government did not move forward with the critical infrastructure plan until after the election. In January 2017, Homeland Security did make the critical infrastructure designation as the intelligence community concluded that Russia was behind the election hacking.

But several Republicans suggested that Johnson's efforts to designate election systems as critical infrastructure may have backfired. "Did that taint the pool of their trust with us?" Senate Intelligence Chairman Richard Burr asked.

Johnson argued that even though they did not make the critical infrastructure designation, more than 30 states still sought DHS help in the run-up to the 2016 election.

Both Nielsen and Johnson noted that some states are more willing to work with DHS than others.

Johnson said there was a role for the Senate to play to help the federal government convince uncooperative states to take help from DHS.

"I would call one of you and say would you please call your governor, would you please call your secretary of state," Johnson said. "I did have that conversation with at least one senator, I recall that very distinctly, and I thought it was very effective."

And Nielsen said there were "two states that aren't working with us as much as we'd like right now and we are working through that."