diff options
author | msmol <msmolash@shutterstock.com> | 2017-06-05 11:45:51 -0400 |
---|---|---|
committer | msmol <msmolash@shutterstock.com> | 2017-06-05 11:45:51 -0400 |
commit | 188b517fdc4d99ba9f01c83fe89b0d33650bbd8f (patch) | |
tree | ad845040775d7c364b1b3bd6193f1e4077c01066 | |
parent | 747b0089697c5f16f66be87894b016573f08f54d (diff) |
Move initializtion of totp env vars to init function
Also update README with more info
-rw-r--r-- | README.md | 5 | ||||
-rw-r--r-- | pass.cpp | 11 |
2 files changed, 9 insertions, 7 deletions
@@ -5,9 +5,10 @@ Integrates [krunner](https://userbase.kde.org/Plasma/Krunner) with [pass](https: ## Use with [pass-otp](https://github.com/tadfisher/pass-otp) -To use with pass-otp, use the identifier "totp::" in the filename or file path of the otp password file. +To use with pass-otp, use the identifier "totp::" as a prefix in the filename or file path of the otp password file. -Alternatively, set $PASSWORD_STORE_OTP_IDENTIFIER to overwrite the identifier string. +Alternatively, set $PASSWORD_STORE_OTP_IDENTIFIER to overwrite the identifier string. This must be set in `.xprofile` +or similar file. Build and Installation ====================== @@ -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,11 +131,6 @@ void Pass::run(const Plasma::RunnerContext &context, const Plasma::QueryMatch &m { Q_UNUSED(context); - this->passOtpIdentifier = "totp::"; - auto passOtpIdentifier = getenv("PASSWORD_STORE_OTP_IDENTIFIER"); - if (passOtpIdentifier != nullptr) { - this->passOtpIdentifier = passOtpIdentifier; - } auto isOtp = match.text().split('/').filter(QRegularExpression("^" + QRegularExpression::escape(this->passOtpIdentifier) + ".*")).size() > 0; auto ret = isOtp ? |