fix 864; made variable names easier for understanding branching.

This commit is contained in:
guzzi_jones 2016-07-30 00:32:35 +00:00
parent 45715960d3
commit 5bee966524
3 changed files with 9 additions and 7 deletions

View File

@ -135,31 +135,33 @@ bool password_container::read_from_tty_double_check(const char *message) {
std::string pass1; std::string pass1;
std::string pass2; std::string pass2;
bool match=false; bool match=false;
bool doNotVerifyEntry=false;
do{ do{
if (message) if (message)
std::cout << message <<": "; std::cout << message <<": ";
if (!password_container::read_from_tty(pass1)) if (!password_container::read_from_tty(pass1))
return false; return false;
if (m_wallet_file_name.empty()){ if (m_wallet_file_name.empty()){//double check password; new wallet
if (message) if (message)
std::cout << message << ": "; std::cout << message << ": ";
if (!password_container::read_from_tty(pass2)) if (!password_container::read_from_tty(pass2))
return false; return false;
if(pass1!=pass2){ if(pass1!=pass2){ //new password entered did not match
std::cout << "Passwords do not match" << std::endl; std::cout << "Passwords do not match" << std::endl;
pass1=""; pass1="";
pass2=""; pass2="";
match=false; match=false;
} }
else{ else{//new password matches
match=true; match=true;
} }
} }
else 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; m_password=pass1;
return true; return true;

View File

@ -39,7 +39,7 @@ namespace tools
{ {
public: public:
static const size_t max_password_size = 1024; 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(password_container&& rhs);
~password_container(); ~password_container();

View File

@ -1222,7 +1222,7 @@ bool simple_wallet::init(const boost::program_options::variables_map& vm)
} }
catch (const std::exception &e) { } 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)) if (!cryptonote::simple_wallet::get_password(vm, true, pwd_container))
return false; return false;