summaryrefslogtreecommitdiff
path: root/noncore/securityplugins/pin/pin.cpp
Side-by-side diff
Diffstat (limited to 'noncore/securityplugins/pin/pin.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/securityplugins/pin/pin.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/noncore/securityplugins/pin/pin.cpp b/noncore/securityplugins/pin/pin.cpp
index 37dc5be..c21ffcd 100644
--- a/noncore/securityplugins/pin/pin.cpp
+++ b/noncore/securityplugins/pin/pin.cpp
@@ -32,26 +32,29 @@
#include <qlabel.h>
#include <qlineedit.h>
#include <qtextview.h>
#include <qstring.h>
#include <qdialog.h>
/* UNIX */
#include <unistd.h>
#include <stdlib.h>
#include <time.h>
extern "C" char *crypt(const char *key, const char *salt);
+using Opie::Security::MultiauthConfigWidget;
+using Opie::Security::MultiauthPluginObject;
+
/// set to TRUE when we press the 'Skip' button
-bool isSkip = FALSE;
+static bool isSkip = FALSE;
/// PIN input graphical widget.
/**
* Inherits the PinDialogBase class defined originally in pinDialogBase.ui interface file.
* \sa PinDlg and PinDialog (the class generated from the .ui file)
* It comes from the original PIN locking code in Opie :
* \sa http://dudu.dyn.2-h.org/opiedoxydoc/library_2password_8cpp-source.html
*/
class PinDialog : public PinDialogBase
{
Q_OBJECT
@@ -223,28 +226,28 @@ bool PinPlugin::verify(const QString& pin, const QString& hash)
}
/// Displays a PinDialog and returns the typed in PIN
/**
* The returned value is QString::null if the user cancels the operation,
* or the empty string if the user enters no password (but confirms the
* dialog).
*/
QString PinPlugin::getPIN( const QString& prompt )
{
PinDlg pd(0,0,TRUE);
pd.pinD->setPrompt( prompt );
-
+
pd.showMaximized();
int r = pd.exec();
-
+
if ( r == QDialog::Accepted ) {
if (pd.pinD->text.isEmpty())
return "";
else
return pd.pinD->text;
}
else
return QString::null;
}
/// Displays the PIN dialog and returns a hash of the typed in PIN
/**
@@ -293,50 +296,50 @@ int PinPlugin::authenticate()
// reset skip (if we ran Pin two times in a row, skipping the first time, it must be put to 0 again)
isSkip = FALSE;
// fetch value in config
Config cfg("Security");
cfg.setGroup("PinPlugin");
QString hashedPin = cfg.readEntry("hashedPIN");
if (!hashedPin.isEmpty())
{
// prompt for the PIN in a fullscreen modal dialog
PinDlg pd(0,0,TRUE,TRUE);
pd.reset();
pd.exec();
-
+
// analyse the result
if (isSkip == TRUE)
return MultiauthPluginObject::Skip;
else if (verify(pd.pinD->text, hashedPin))
return MultiauthPluginObject::Success;
- else
+ else
return MultiauthPluginObject::Failure;
}
owarn << "No PIN has been defined! We consider it as a successful authentication though." << oendl;
return MultiauthPluginObject::Success;
}
/// Simply returns the plugin name (PIN plugin)
QString PinPlugin::pluginName() const {
return "PIN Plugin";
}
QString PinPlugin::pixmapNameWidget() const {
return "security/pinplugin";
}
QString PinPlugin::pixmapNameConfig() const {
return "security/pinplugin";
}
/// returns a PinConfigWidget
MultiauthConfigWidget * PinPlugin::configWidget(QWidget * parent) {
PinConfigWidget * pinw = new PinConfigWidget(parent, "PIN configuration widget");
-
+
connect(pinw->changePIN, SIGNAL( clicked() ), this, SLOT( changePIN() ));
connect(pinw->clearPIN, SIGNAL( clicked() ), this, SLOT( clearPIN() ));
-
+
return pinw;
}
#include "pin.moc"