bool password_container::read_password() { clear(); bool r; if (is_cin_tty()) { std::cout << "password: "; r = read_from_tty(); } else { r = read_from_file(); } if (r) { m_empty = false; } else { clear(); } return r; }
boost::optional<password_container> password_container::prompt(const bool verify, const char *message) { is_prompting = true; 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)) { is_prompting = false; return {std::move(pass1)}; } is_prompting = false; return boost::none; }