Make saving of the entered password work to.toStdString

Also when testing a preexisting connection config it will now decode a potential stored password.
This commit is contained in:
eelke 2021-07-04 19:33:06 +02:00
parent c00a0452d1
commit 87cfb84997
6 changed files with 117 additions and 70 deletions

View file

@ -6,6 +6,7 @@
class MasterController;
class ConnectionConfig;
class ConnectionConfigurationWidget;
class ConnectionList;
class ConnectionTreeModel;
class ConnectionManagerWindow;
@ -40,6 +41,14 @@ public:
void removeGroup(QModelIndex index);
std::shared_ptr<PasswordManager> passwordManager();
/** Retrieves the connection password from the user (directly or through the psk db)
*
*/
bool retrieveConnectionPassword(ConnectionConfig &cc);
bool UnlockPasswordManagerIfNeeded();
bool decodeConnectionPassword(QUuid id, QByteArray encoded, QString &out_password);
private:
MasterController *m_masterController;
ConnectionList *m_connectionList = nullptr;
@ -52,21 +61,15 @@ private:
*/
std::shared_ptr<PasswordManager> m_passwordManager;
/** Retrieves the connection password from the user (directly or through the psk db)
*
*/
bool retrieveConnectionPassword(ConnectionConfig &cc);
bool retrieveFromPasswordManager(const std::string &password_id, const std::string_view &enc_password, std::string &password);
// bool updatePasswordManager(const std::string &password_id, const std::string &password, std::string &enc_password);
bool decodePassword(const std::string &password_id, const std::string_view &enc_password, std::string &password);
bool encodePassword(const std::string &password_id, const std::string &password, std::string &enc_password);
/// Expects the plaintext password to be the password that needs encoding.
bool encryptPassword(ConnectionConfig &cc);
///
///
/// \return bool: succeeded, int: relock timeout
///
bool UnlockPasswordManagerIfNeeded();
static std::string getPskId(QUuid connectionid);
static std::string getPskId(const ConnectionConfig &cc);
void saveConnection(ConnectionConfigurationWidget &w);
private slots:
void relock();
};