From d7a4ad4a40a1bf6b08786dc2375a9228c4d9a0c1 Mon Sep 17 00:00:00 2001 From: kedar Date: Sat, 1 Jun 2019 22:18:34 -0700 Subject: [PATCH] enable key resets --- eosio.lost.cpp | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/eosio.lost.cpp b/eosio.lost.cpp index 1e8c343..f42d704 100644 --- a/eosio.lost.cpp +++ b/eosio.lost.cpp @@ -104,7 +104,7 @@ void lostcontract::verify(std::vector sig, name account, public_key newpub auto whitelisted = whitelist.get(account.value, "Account is not whitelisted"); auto verification = verifications.find(account.value); - eosio_assert(verification == verifications.end(), "Account already verified"); + eosio_assert(verification == verifications.end() || verification->updated == 0, "Account has already been updated"); ///////////////////////// @@ -166,12 +166,20 @@ void lostcontract::verify(std::vector sig, name account, public_key newpub eosio_assert( calculated_eth_address == lowercase_whitelist, "Message was not properly signed by the ETH key for the account" ); // Once all checks have passed, store the key change information - verifications.emplace(rampayer, [&](verify_info &v){ - v.claimer = account; - v.added = time_point_sec(now()); - v.new_key = newpubkey; - v.updated = 0; - }); + if (verification == verifications.end()) { + verifications.emplace(rampayer, [&](verify_info &v){ + v.claimer = account; + v.added = time_point_sec(now()); + v.new_key = newpubkey; + v.updated = 0; + }); + } + else { + verifications.modify(verification, rampayer, [&](verify_info &v){ + v.added = time_point_sec(now()); + v.new_key = newpubkey; + }); + } string msg = "Someone is trying to reset your EOS private key"; action(permission_level{_self, "active"_n},