Skip to content

Commit

Permalink
Simple way to understand if Pass OTP extension is installed.
Browse files Browse the repository at this point in the history
  • Loading branch information
FiloSpaTeam committed Aug 12, 2018
1 parent 990b89c commit 5fc6c65
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/configdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ ConfigDialog::ConfigDialog(MainWindow *parent)
ui->label_10->hide();
#endif

if (!isPassOtpAvailable()) {
ui->checkBoxUseOtp->setEnabled(false);
}

setProfiles(QtPassSettings::getProfiles(), QtPassSettings::getProfile());
setPwgenPath(QtPassSettings::getPwgenExecutable());
setPasswordConfiguration(QtPassSettings::getPasswordConfiguration());
Expand All @@ -71,7 +75,9 @@ ConfigDialog::ConfigDialog(MainWindow *parent)
useAutoclearPanel(QtPassSettings::isUseAutoclearPanel());
useTrayIcon(QtPassSettings::isUseTrayIcon());
useGit(QtPassSettings::isUseGit());

useOtp(QtPassSettings::isUseOtp());

usePwgen(QtPassSettings::isUsePwgen());
useTemplate(QtPassSettings::isUseTemplate());

Expand Down Expand Up @@ -473,6 +479,18 @@ void ConfigDialog::criticalMessage(const QString &title, const QString &text) {
QMessageBox::critical(this, title, text, QMessageBox::Ok, QMessageBox::Ok);
}

bool ConfigDialog::isPassOtpAvailable() {
#ifdef Q_OS_WIN
return false
#elif defined(__APPLE__)
return false
#else
QFileInfo file("/usr/lib/password-store/extensions/otp.bash");

return file.exists();
#endif
}

/**
* @brief ConfigDialog::wizard first-time use wizard.
* @todo make this thing more reliable.
Expand Down
2 changes: 2 additions & 0 deletions src/configdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ private slots:
// Qt 5.4.1 when QApplication::exec was not yet called
void criticalMessage(const QString &title, const QString &text);

bool isPassOtpAvailable();

MainWindow *mainWindow;
};

Expand Down

0 comments on commit 5fc6c65

Please sign in to comment.