diff options
author | Anne Jan Brouwer <brouwer@annejan.com> | 2016-06-10 19:07:34 +0200 |
---|---|---|
committer | Anne Jan Brouwer <brouwer@annejan.com> | 2016-06-10 19:07:34 +0200 |
commit | 7e09ea9fb44efc285ba9c67188bab7b1ff5379d3 (patch) | |
tree | a67ccc13237b377f451e2c43b4868de1f13e4722 | |
parent | 80525bc18c4ceaf5a77ae747824ecb54947e90de (diff) |
Fixed user adding for pass users
-rw-r--r-- | mainwindow.cpp | 89 | ||||
-rw-r--r-- | qtpass.iss | 2 | ||||
-rw-r--r-- | qtpass.pro | 2 | ||||
-rw-r--r-- | qtpass.spec | 2 |
4 files changed, 56 insertions, 39 deletions
diff --git a/mainwindow.cpp b/mainwindow.cpp index 199692e2..b3b0d6c4 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -1394,43 +1394,60 @@ void MainWindow::on_usersButton_clicked() { return; } d.setUsers(NULL); - QString gpgIdFile = dir + ".gpg-id"; - QFile gpgId(gpgIdFile); - bool addFile = false; - if (addGPGId) { - QFileInfo checkFile(gpgIdFile); - if (!checkFile.exists() || !checkFile.isFile()) - addFile = true; - } - if (!gpgId.open(QIODevice::WriteOnly | QIODevice::Text)) { - QMessageBox::critical(this, tr("Cannot update"), - tr("Failed to open .gpg-id for writing.")); - return; - } - bool secret_selected = false; - foreach (const UserInfo &user, users) { - if (user.enabled) { - gpgId.write((user.key_id + "\n").toUtf8()); - secret_selected |= user.have_secret; - } - } - gpgId.close(); - if (!secret_selected) { - QMessageBox::critical( - this, tr("Check selected users!"), - tr("None of the selected keys have a secret key available.\n" - "You will not be able to decrypt any newly added passwords!")); - } - if (!useWebDav && useGit && !gitExecutable.isEmpty()) { - if (addFile) - executeWrapper(gitExecutable, "add \"" + gpgIdFile + '"'); - QString path = gpgIdFile; - path.replace(QRegExp("\\.gpg$"), ""); - executeWrapper(gitExecutable, "commit \"" + gpgIdFile + "\" -m \"Added " + - path + " using QtPass.\""); - if (autoPush) - on_pushButton_clicked(); + + if (usePass) { + QString gpgIds = ""; + foreach (const UserInfo &user, users) { + if (user.enabled) { + gpgIds += user.key_id + " "; + } + } + executePass("init --path=" + dir + " " + gpgIds); + } else { + QString gpgIdFile = dir + ".gpg-id"; + QFile gpgId(gpgIdFile); + bool addFile = false; + if (addGPGId) { + QFileInfo checkFile(gpgIdFile); + if (!checkFile.exists() || !checkFile.isFile()) + addFile = true; + } + if (!gpgId.open(QIODevice::WriteOnly | QIODevice::Text)) { + QMessageBox::critical(this, tr("Cannot update"), + tr("Failed to open .gpg-id for writing.")); + return; + } + bool secret_selected = false; + foreach (const UserInfo &user, users) { + if (user.enabled) { + gpgId.write((user.key_id + "\n").toUtf8()); + secret_selected |= user.have_secret; + } + } + gpgId.close(); + if (!secret_selected) { + QMessageBox::critical( + this, tr("Check selected users!"), + tr("None of the selected keys have a secret key available.\n" + "You will not be able to decrypt any newly added passwords!")); + } + QMessageBox::information( + this, tr("Recursing not yet implemented!"), + tr("This is an issue that only happens when you are not using pass.\n" + "Some people might not correctly be encrypted for!")); + if (!useWebDav && useGit && !gitExecutable.isEmpty()) { + if (addFile) + executeWrapper(gitExecutable, "add \"" + gpgIdFile + '"'); + QString path = gpgIdFile; + path.replace(QRegExp("\\.gpg$"), ""); + executeWrapper(gitExecutable, "commit \"" + gpgIdFile + "\" -m \"Added " + + path + " using QtPass.\""); + if (autoPush) + on_pushButton_clicked(); + } } + + } /** @@ -2,7 +2,7 @@ ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName "QtPass"
-#define MyAppVersion "1.1.2"
+#define MyAppVersion "1.1.3"
#define MyAppPublisher "IJhack"
#define MyAppURL "https://qtpass.org/"
#define MyAppExeName "qtpass.exe"
@@ -7,7 +7,7 @@ # # #---------------------------------------------------------- -VERSION = 1.1.2 +VERSION = 1.1.3 TEMPLATE = app QT += core gui diff --git a/qtpass.spec b/qtpass.spec index beb3d479..cff6c246 100644 --- a/qtpass.spec +++ b/qtpass.spec @@ -7,7 +7,7 @@ # This should probably be part of a release process. Name: qtpass -Version: 1.1.2 +Version: 1.1.3 Release: 2%{?dist} Summary: QtPass is a multi-platform GUI for pass, the standard unix password manager. License: GPLv3 |