Make the wallet name optional when locked.
This commit is contained in:
parent
d562deaaa9
commit
354e1d9c65
|
@ -2988,6 +2988,19 @@ bool simple_wallet::set_track_uses(const std::vector<std::string> &args/* = std:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool simple_wallet::set_show_wallet_name_when_locked(const std::vector<std::string> &args/* = std::vector<std::string>()*/)
|
||||||
|
{
|
||||||
|
const auto pwd_container = get_and_verify_password();
|
||||||
|
if (pwd_container)
|
||||||
|
{
|
||||||
|
parse_bool_and_use(args[1], [&](bool r) {
|
||||||
|
m_wallet->show_wallet_name_when_locked(r);
|
||||||
|
m_wallet->rewrite(m_wallet_file, pwd_container->password());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool simple_wallet::set_inactivity_lock_timeout(const std::vector<std::string> &args/* = std::vector<std::string>()*/)
|
bool simple_wallet::set_inactivity_lock_timeout(const std::vector<std::string> &args/* = std::vector<std::string>()*/)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
@ -3431,6 +3444,8 @@ simple_wallet::simple_wallet()
|
||||||
" Whether to automatically start mining for RPC payment if the daemon requires it.\n"
|
" Whether to automatically start mining for RPC payment if the daemon requires it.\n"
|
||||||
"credits-target <unsigned int>\n"
|
"credits-target <unsigned int>\n"
|
||||||
" The RPC payment credits balance to target (0 for default).\n "
|
" The RPC payment credits balance to target (0 for default).\n "
|
||||||
|
"show-wallet-name-when-locked <1|0>\n "
|
||||||
|
" Set this if you would like to display the wallet name when locked.\n "
|
||||||
"inactivity-lock-timeout <unsigned int>\n "
|
"inactivity-lock-timeout <unsigned int>\n "
|
||||||
" How many seconds to wait before locking the wallet (0 to disable)."));
|
" How many seconds to wait before locking the wallet (0 to disable)."));
|
||||||
m_cmd_binder.set_handler("encrypted_seed",
|
m_cmd_binder.set_handler("encrypted_seed",
|
||||||
|
@ -3836,6 +3851,7 @@ bool simple_wallet::set_variable(const std::vector<std::string> &args)
|
||||||
success_msg_writer() << "setup-background-mining = " << setup_background_mining_string;
|
success_msg_writer() << "setup-background-mining = " << setup_background_mining_string;
|
||||||
success_msg_writer() << "device-name = " << m_wallet->device_name();
|
success_msg_writer() << "device-name = " << m_wallet->device_name();
|
||||||
success_msg_writer() << "export-format = " << (m_wallet->export_format() == tools::wallet2::ExportFormat::Ascii ? "ascii" : "binary");
|
success_msg_writer() << "export-format = " << (m_wallet->export_format() == tools::wallet2::ExportFormat::Ascii ? "ascii" : "binary");
|
||||||
|
success_msg_writer() << "show-wallet-name-when-locked = " << m_wallet->show_wallet_name_when_locked();
|
||||||
success_msg_writer() << "inactivity-lock-timeout = " << m_wallet->inactivity_lock_timeout()
|
success_msg_writer() << "inactivity-lock-timeout = " << m_wallet->inactivity_lock_timeout()
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
<< " (disabled on Windows)"
|
<< " (disabled on Windows)"
|
||||||
|
@ -3903,6 +3919,7 @@ bool simple_wallet::set_variable(const std::vector<std::string> &args)
|
||||||
CHECK_SIMPLE_VARIABLE("ignore-outputs-above", set_ignore_outputs_above, tr("amount"));
|
CHECK_SIMPLE_VARIABLE("ignore-outputs-above", set_ignore_outputs_above, tr("amount"));
|
||||||
CHECK_SIMPLE_VARIABLE("ignore-outputs-below", set_ignore_outputs_below, tr("amount"));
|
CHECK_SIMPLE_VARIABLE("ignore-outputs-below", set_ignore_outputs_below, tr("amount"));
|
||||||
CHECK_SIMPLE_VARIABLE("track-uses", set_track_uses, tr("0 or 1"));
|
CHECK_SIMPLE_VARIABLE("track-uses", set_track_uses, tr("0 or 1"));
|
||||||
|
CHECK_SIMPLE_VARIABLE("show-wallet-name-when-locked", set_show_wallet_name_when_locked, tr("1 or 0"));
|
||||||
CHECK_SIMPLE_VARIABLE("inactivity-lock-timeout", set_inactivity_lock_timeout, tr("unsigned integer (seconds, 0 to disable)"));
|
CHECK_SIMPLE_VARIABLE("inactivity-lock-timeout", set_inactivity_lock_timeout, tr("unsigned integer (seconds, 0 to disable)"));
|
||||||
CHECK_SIMPLE_VARIABLE("setup-background-mining", set_setup_background_mining, tr("1/yes or 0/no"));
|
CHECK_SIMPLE_VARIABLE("setup-background-mining", set_setup_background_mining, tr("1/yes or 0/no"));
|
||||||
CHECK_SIMPLE_VARIABLE("device-name", set_device_name, tr("<device_name[:device_spec]>"));
|
CHECK_SIMPLE_VARIABLE("device-name", set_device_name, tr("<device_name[:device_spec]>"));
|
||||||
|
@ -6463,6 +6480,16 @@ void simple_wallet::check_for_inactivity_lock(bool user)
|
||||||
{
|
{
|
||||||
const char *inactivity_msg = user ? "" : tr("Locked due to inactivity.");
|
const char *inactivity_msg = user ? "" : tr("Locked due to inactivity.");
|
||||||
tools::msg_writer() << inactivity_msg << (inactivity_msg[0] ? " " : "") << tr("The wallet password is required to unlock the console.");
|
tools::msg_writer() << inactivity_msg << (inactivity_msg[0] ? " " : "") << tr("The wallet password is required to unlock the console.");
|
||||||
|
|
||||||
|
const bool show_wallet_name = m_wallet->show_wallet_name_when_locked();
|
||||||
|
if (show_wallet_name)
|
||||||
|
{
|
||||||
|
tools::msg_writer() << tr("Filename: ") << m_wallet->get_wallet_file();
|
||||||
|
tools::msg_writer() << tr("Network type: ") << (
|
||||||
|
m_wallet->nettype() == cryptonote::TESTNET ? tr("Testnet") :
|
||||||
|
m_wallet->nettype() == cryptonote::STAGENET ? tr("Stagenet") : tr("Mainnet")
|
||||||
|
);
|
||||||
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (get_and_verify_password())
|
if (get_and_verify_password())
|
||||||
|
|
|
@ -148,6 +148,7 @@ namespace cryptonote
|
||||||
bool set_ignore_outputs_above(const std::vector<std::string> &args = std::vector<std::string>());
|
bool set_ignore_outputs_above(const std::vector<std::string> &args = std::vector<std::string>());
|
||||||
bool set_ignore_outputs_below(const std::vector<std::string> &args = std::vector<std::string>());
|
bool set_ignore_outputs_below(const std::vector<std::string> &args = std::vector<std::string>());
|
||||||
bool set_track_uses(const std::vector<std::string> &args = std::vector<std::string>());
|
bool set_track_uses(const std::vector<std::string> &args = std::vector<std::string>());
|
||||||
|
bool set_show_wallet_name_when_locked(const std::vector<std::string> &args = std::vector<std::string>());
|
||||||
bool set_inactivity_lock_timeout(const std::vector<std::string> &args = std::vector<std::string>());
|
bool set_inactivity_lock_timeout(const std::vector<std::string> &args = std::vector<std::string>());
|
||||||
bool set_setup_background_mining(const std::vector<std::string> &args = std::vector<std::string>());
|
bool set_setup_background_mining(const std::vector<std::string> &args = std::vector<std::string>());
|
||||||
bool set_device_name(const std::vector<std::string> &args = std::vector<std::string>());
|
bool set_device_name(const std::vector<std::string> &args = std::vector<std::string>());
|
||||||
|
|
|
@ -1168,6 +1168,7 @@ wallet2::wallet2(network_type nettype, uint64_t kdf_rounds, bool unattended, std
|
||||||
m_ignore_outputs_above(MONEY_SUPPLY),
|
m_ignore_outputs_above(MONEY_SUPPLY),
|
||||||
m_ignore_outputs_below(0),
|
m_ignore_outputs_below(0),
|
||||||
m_track_uses(false),
|
m_track_uses(false),
|
||||||
|
m_show_wallet_name_when_locked(false),
|
||||||
m_inactivity_lock_timeout(DEFAULT_INACTIVITY_LOCK_TIMEOUT),
|
m_inactivity_lock_timeout(DEFAULT_INACTIVITY_LOCK_TIMEOUT),
|
||||||
m_setup_background_mining(BackgroundMiningMaybe),
|
m_setup_background_mining(BackgroundMiningMaybe),
|
||||||
m_persistent_rpc_client_id(false),
|
m_persistent_rpc_client_id(false),
|
||||||
|
@ -3966,6 +3967,9 @@ boost::optional<wallet2::keys_file_data> wallet2::get_keys_file_data(const epee:
|
||||||
value2.SetInt(m_track_uses ? 1 : 0);
|
value2.SetInt(m_track_uses ? 1 : 0);
|
||||||
json.AddMember("track_uses", value2, json.GetAllocator());
|
json.AddMember("track_uses", value2, json.GetAllocator());
|
||||||
|
|
||||||
|
value2.SetInt(m_show_wallet_name_when_locked ? 1 : 0);
|
||||||
|
json.AddMember("show_wallet_name_when_locked", value2, json.GetAllocator());
|
||||||
|
|
||||||
value2.SetInt(m_inactivity_lock_timeout);
|
value2.SetInt(m_inactivity_lock_timeout);
|
||||||
json.AddMember("inactivity_lock_timeout", value2, json.GetAllocator());
|
json.AddMember("inactivity_lock_timeout", value2, json.GetAllocator());
|
||||||
|
|
||||||
|
@ -4150,6 +4154,7 @@ bool wallet2::load_keys_buf(const std::string& keys_buf, const epee::wipeable_st
|
||||||
m_ignore_outputs_above = MONEY_SUPPLY;
|
m_ignore_outputs_above = MONEY_SUPPLY;
|
||||||
m_ignore_outputs_below = 0;
|
m_ignore_outputs_below = 0;
|
||||||
m_track_uses = false;
|
m_track_uses = false;
|
||||||
|
m_show_wallet_name_when_locked = false;
|
||||||
m_inactivity_lock_timeout = DEFAULT_INACTIVITY_LOCK_TIMEOUT;
|
m_inactivity_lock_timeout = DEFAULT_INACTIVITY_LOCK_TIMEOUT;
|
||||||
m_setup_background_mining = BackgroundMiningMaybe;
|
m_setup_background_mining = BackgroundMiningMaybe;
|
||||||
m_subaddress_lookahead_major = SUBADDRESS_LOOKAHEAD_MAJOR;
|
m_subaddress_lookahead_major = SUBADDRESS_LOOKAHEAD_MAJOR;
|
||||||
|
@ -4324,6 +4329,8 @@ bool wallet2::load_keys_buf(const std::string& keys_buf, const epee::wipeable_st
|
||||||
m_ignore_outputs_below = field_ignore_outputs_below;
|
m_ignore_outputs_below = field_ignore_outputs_below;
|
||||||
GET_FIELD_FROM_JSON_RETURN_ON_ERROR(json, track_uses, int, Int, false, false);
|
GET_FIELD_FROM_JSON_RETURN_ON_ERROR(json, track_uses, int, Int, false, false);
|
||||||
m_track_uses = field_track_uses;
|
m_track_uses = field_track_uses;
|
||||||
|
GET_FIELD_FROM_JSON_RETURN_ON_ERROR(json, show_wallet_name_when_locked, int, Int, false, false);
|
||||||
|
m_show_wallet_name_when_locked = field_show_wallet_name_when_locked;
|
||||||
GET_FIELD_FROM_JSON_RETURN_ON_ERROR(json, inactivity_lock_timeout, uint32_t, Uint, false, DEFAULT_INACTIVITY_LOCK_TIMEOUT);
|
GET_FIELD_FROM_JSON_RETURN_ON_ERROR(json, inactivity_lock_timeout, uint32_t, Uint, false, DEFAULT_INACTIVITY_LOCK_TIMEOUT);
|
||||||
m_inactivity_lock_timeout = field_inactivity_lock_timeout;
|
m_inactivity_lock_timeout = field_inactivity_lock_timeout;
|
||||||
GET_FIELD_FROM_JSON_RETURN_ON_ERROR(json, setup_background_mining, BackgroundMiningSetupType, Int, false, BackgroundMiningMaybe);
|
GET_FIELD_FROM_JSON_RETURN_ON_ERROR(json, setup_background_mining, BackgroundMiningSetupType, Int, false, BackgroundMiningMaybe);
|
||||||
|
|
|
@ -1204,6 +1204,8 @@ private:
|
||||||
void ignore_outputs_below(uint64_t value) { m_ignore_outputs_below = value; }
|
void ignore_outputs_below(uint64_t value) { m_ignore_outputs_below = value; }
|
||||||
bool track_uses() const { return m_track_uses; }
|
bool track_uses() const { return m_track_uses; }
|
||||||
void track_uses(bool value) { m_track_uses = value; }
|
void track_uses(bool value) { m_track_uses = value; }
|
||||||
|
bool show_wallet_name_when_locked() const { return m_show_wallet_name_when_locked; }
|
||||||
|
void show_wallet_name_when_locked(bool value) { m_show_wallet_name_when_locked = value; }
|
||||||
BackgroundMiningSetupType setup_background_mining() const { return m_setup_background_mining; }
|
BackgroundMiningSetupType setup_background_mining() const { return m_setup_background_mining; }
|
||||||
void setup_background_mining(BackgroundMiningSetupType value) { m_setup_background_mining = value; }
|
void setup_background_mining(BackgroundMiningSetupType value) { m_setup_background_mining = value; }
|
||||||
uint32_t inactivity_lock_timeout() const { return m_inactivity_lock_timeout; }
|
uint32_t inactivity_lock_timeout() const { return m_inactivity_lock_timeout; }
|
||||||
|
@ -1717,6 +1719,7 @@ private:
|
||||||
uint64_t m_ignore_outputs_above;
|
uint64_t m_ignore_outputs_above;
|
||||||
uint64_t m_ignore_outputs_below;
|
uint64_t m_ignore_outputs_below;
|
||||||
bool m_track_uses;
|
bool m_track_uses;
|
||||||
|
bool m_show_wallet_name_when_locked;
|
||||||
uint32_t m_inactivity_lock_timeout;
|
uint32_t m_inactivity_lock_timeout;
|
||||||
BackgroundMiningSetupType m_setup_background_mining;
|
BackgroundMiningSetupType m_setup_background_mining;
|
||||||
bool m_persistent_rpc_client_id;
|
bool m_persistent_rpc_client_id;
|
||||||
|
|
Loading…
Reference in New Issue