diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2017-10-28 19:13:42 +0100 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2017-11-14 17:06:26 +0000 |
commit | e89994e98f85be95d68c7bf471fcadf9aabbc93a (patch) | |
tree | 2cb9f29bc15e4488eeaeee81115d791babced4fc /src/common/password.cpp | |
parent | move input_line from command_line to simplewallet (diff) | |
download | monero-e89994e98f85be95d68c7bf471fcadf9aabbc93a.tar.xz |
wallet: rejig to avoid prompting in wallet2
wallet2 is a library, and should not prompt for stdin. Instead,
pass a function so simplewallet can prompt on stdin, and a GUI
might display a window, etc.
Diffstat (limited to 'src/common/password.cpp')
-rw-r--r-- | src/common/password.cpp | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/common/password.cpp b/src/common/password.cpp index b84d6fb2e..5d56464a5 100644 --- a/src/common/password.cpp +++ b/src/common/password.cpp @@ -238,9 +238,6 @@ namespace tools boost::optional<password_container> password_container::prompt(const bool verify, const char *message) { -#ifdef HAVE_READLINE - rdln::suspend_readline pause_readline; -#endif password_container pass1{}; password_container pass2{}; if (is_cin_tty() ? read_from_tty(verify, message, pass1.m_password, pass2.m_password) : read_from_file(pass1.m_password)) @@ -249,7 +246,7 @@ namespace tools return boost::none; } - boost::optional<login> login::parse(std::string&& userpass, bool verify, const char* message) + boost::optional<login> login::parse(std::string&& userpass, bool verify, const std::function<boost::optional<password_container>(bool)> &prompt) { login out{}; password_container wipe{std::move(userpass)}; @@ -257,7 +254,7 @@ namespace tools const auto loc = wipe.password().find(':'); if (loc == std::string::npos) { - auto result = tools::password_container::prompt(verify, message); + auto result = prompt(verify); if (!result) return boost::none; |