|
|
|
|
@ -61,6 +61,12 @@ void Pass::init() { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
this->passOtpIdentifier = "totp::"; |
|
|
|
|
auto passOtpIdentifier = getenv("PASSWORD_STORE_OTP_IDENTIFIER"); |
|
|
|
|
if (passOtpIdentifier != nullptr) { |
|
|
|
|
this->passOtpIdentifier = passOtpIdentifier; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
initPasswords(); |
|
|
|
|
|
|
|
|
|
connect(&watcher, SIGNAL(directoryChanged(QString)), this, SLOT(reinitPasswords(QString))); |
|
|
|
|
@ -125,7 +131,12 @@ void Pass::run(const Plasma::RunnerContext &context, const Plasma::QueryMatch &m |
|
|
|
|
{ |
|
|
|
|
Q_UNUSED(context); |
|
|
|
|
|
|
|
|
|
auto ret = QProcess::execute(QString("pass -c ") + match.text()); |
|
|
|
|
auto regexp = QRegularExpression("^" + QRegularExpression::escape(this->passOtpIdentifier) + ".*"); |
|
|
|
|
auto isOtp = match.text().split('/').filter(regexp).size() > 0; |
|
|
|
|
|
|
|
|
|
auto ret = isOtp ? |
|
|
|
|
QProcess::execute(QString("pass otp -c ") + match.text()) : |
|
|
|
|
QProcess::execute(QString("pass -c ") + match.text()); |
|
|
|
|
if (ret == 0) { |
|
|
|
|
QString msg = i18n("Password %1 copied to clipboard for %2 seconds", match.text(), timeout); |
|
|
|
|
KNotification::event("password-unlocked", "Pass", msg, |
|
|
|
|
|