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 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;

View File

@ -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();

View File

@ -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;