UserInterface: provide simple default implementation
A default implementation for optional, read-only access to the keyrings.
This commit is contained in:
parent
8b391dbb79
commit
12f3545e4f
|
@ -202,6 +202,22 @@ SavePasswordSignal &GetSavePasswordSignal();
|
|||
|
||||
static const int INTERNAL_SAVE_PASSWORD_SLOTS = 2;
|
||||
|
||||
class SimpleUserInterface : public UserInterface
|
||||
{
|
||||
InitStateTri m_useKeyring;
|
||||
|
||||
public:
|
||||
SimpleUserInterface(InitStateTri useKeyring) : m_useKeyring(useKeyring) {}
|
||||
virtual std::string askPassword(const std::string &passwordName, const std::string &descr, const ConfigPasswordKey &key) {
|
||||
InitStateString password;
|
||||
// Try to use keyring, if allowed.
|
||||
GetLoadPasswordSignal()(m_useKeyring, passwordName, descr, key, password);
|
||||
return password;
|
||||
}
|
||||
virtual bool savePassword(const std::string &passwordName, const std::string &password, const ConfigPasswordKey &key) { return false; }
|
||||
virtual void readStdin(std::string &content) { content.clear(); }
|
||||
};
|
||||
|
||||
SE_END_CXX
|
||||
|
||||
#endif // INCL_USERINTERFACE
|
||||
|
|
Loading…
Reference in New Issue