From 5bee96652434762d2c91ce31a1b1c9f169446ddc Mon Sep 17 00:00:00 2001 From: guzzi_jones Date: Sat, 30 Jul 2016 00:32:35 +0000 Subject: [PATCH] fix 864; made variable names easier for understanding branching. --- src/simplewallet/password_container.cpp | 12 +++++++----- src/simplewallet/password_container.h | 2 +- src/simplewallet/simplewallet.cpp | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/simplewallet/password_container.cpp b/src/simplewallet/password_container.cpp index e0d935ff6..1486f523f 100644 --- a/src/simplewallet/password_container.cpp +++ b/src/simplewallet/password_container.cpp @@ -135,31 +135,33 @@ bool password_container::read_from_tty_double_check(const char *message) { std::string pass1; std::string pass2; bool match=false; + bool doNotVerifyEntry=false; do{ if (message) std::cout << message <<": "; if (!password_container::read_from_tty(pass1)) return false; - if (m_wallet_file_name.empty()){ + if (m_wallet_file_name.empty()){//double check password; new wallet if (message) std::cout << message << ": "; if (!password_container::read_from_tty(pass2)) return false; - if(pass1!=pass2){ + if(pass1!=pass2){ //new password entered did not match std::cout << "Passwords do not match" << std::endl; pass1=""; pass2=""; match=false; } - else{ + else{//new password matches match=true; } } else - match=true; + doNotVerifyEntry=true; //this is not a new wallet + //No need to verify password entered at this point in the code - }while(match==false); + }while(match==false && doNotVerifyEntry==false); m_password=pass1; return true; diff --git a/src/simplewallet/password_container.h b/src/simplewallet/password_container.h index c20f8c9f4..cb993d197 100644 --- a/src/simplewallet/password_container.h +++ b/src/simplewallet/password_container.h @@ -39,7 +39,7 @@ namespace tools { public: static const size_t max_password_size = 1024; - password_container(const std::string walletFileName = ""); + password_container(const std::string walletFileName); password_container(password_container&& rhs); ~password_container(); diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp index d1a64c1a2..a42fadf14 100644 --- a/src/simplewallet/simplewallet.cpp +++ b/src/simplewallet/simplewallet.cpp @@ -1222,7 +1222,7 @@ bool simple_wallet::init(const boost::program_options::variables_map& vm) } catch (const std::exception &e) { } - tools::password_container pwd_container(m_wallet_file); + tools::password_container pwd_container(m_wallet_file); //m_wallet_file will be empty at this point for new wallets if (!cryptonote::simple_wallet::get_password(vm, true, pwd_container)) return false;