Diffstat (limited to 'noncore/securityplugins/pin/pin.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/securityplugins/pin/pin.cpp | 17 |
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 | |||
@@ -38,14 +38,17 @@ | |||
38 | #include <unistd.h> | 38 | #include <unistd.h> |
39 | #include <stdlib.h> | 39 | #include <stdlib.h> |
40 | #include <time.h> | 40 | #include <time.h> |
41 | 41 | ||
42 | extern "C" char *crypt(const char *key, const char *salt); | 42 | extern "C" char *crypt(const char *key, const char *salt); |
43 | 43 | ||
44 | using Opie::Security::MultiauthConfigWidget; | ||
45 | using Opie::Security::MultiauthPluginObject; | ||
46 | |||
44 | /// set to TRUE when we press the 'Skip' button | 47 | /// set to TRUE when we press the 'Skip' button |
45 | bool isSkip = FALSE; | 48 | static bool isSkip = FALSE; |
46 | 49 | ||
47 | /// PIN input graphical widget. | 50 | /// PIN input graphical widget. |
48 | /** | 51 | /** |
49 | * Inherits the PinDialogBase class defined originally in pinDialogBase.ui interface file. | 52 | * Inherits the PinDialogBase class defined originally in pinDialogBase.ui interface file. |
50 | * \sa PinDlg and PinDialog (the class generated from the .ui file) | 53 | * \sa PinDlg and PinDialog (the class generated from the .ui file) |
51 | * It comes from the original PIN locking code in Opie : | 54 | * It comes from the original PIN locking code in Opie : |
@@ -229,16 +232,16 @@ bool PinPlugin::verify(const QString& pin, const QString& hash) | |||
229 | * dialog). | 232 | * dialog). |
230 | */ | 233 | */ |
231 | QString PinPlugin::getPIN( const QString& prompt ) | 234 | QString PinPlugin::getPIN( const QString& prompt ) |
232 | { | 235 | { |
233 | PinDlg pd(0,0,TRUE); | 236 | PinDlg pd(0,0,TRUE); |
234 | pd.pinD->setPrompt( prompt ); | 237 | pd.pinD->setPrompt( prompt ); |
235 | 238 | ||
236 | pd.showMaximized(); | 239 | pd.showMaximized(); |
237 | int r = pd.exec(); | 240 | int r = pd.exec(); |
238 | 241 | ||
239 | if ( r == QDialog::Accepted ) { | 242 | if ( r == QDialog::Accepted ) { |
240 | if (pd.pinD->text.isEmpty()) | 243 | if (pd.pinD->text.isEmpty()) |
241 | return ""; | 244 | return ""; |
242 | else | 245 | else |
243 | return pd.pinD->text; | 246 | return pd.pinD->text; |
244 | } | 247 | } |
@@ -299,19 +302,19 @@ int PinPlugin::authenticate() | |||
299 | if (!hashedPin.isEmpty()) | 302 | if (!hashedPin.isEmpty()) |
300 | { | 303 | { |
301 | // prompt for the PIN in a fullscreen modal dialog | 304 | // prompt for the PIN in a fullscreen modal dialog |
302 | PinDlg pd(0,0,TRUE,TRUE); | 305 | PinDlg pd(0,0,TRUE,TRUE); |
303 | pd.reset(); | 306 | pd.reset(); |
304 | pd.exec(); | 307 | pd.exec(); |
305 | 308 | ||
306 | // analyse the result | 309 | // analyse the result |
307 | if (isSkip == TRUE) | 310 | if (isSkip == TRUE) |
308 | return MultiauthPluginObject::Skip; | 311 | return MultiauthPluginObject::Skip; |
309 | else if (verify(pd.pinD->text, hashedPin)) | 312 | else if (verify(pd.pinD->text, hashedPin)) |
310 | return MultiauthPluginObject::Success; | 313 | return MultiauthPluginObject::Success; |
311 | else | 314 | else |
312 | return MultiauthPluginObject::Failure; | 315 | return MultiauthPluginObject::Failure; |
313 | } | 316 | } |
314 | owarn << "No PIN has been defined! We consider it as a successful authentication though." << oendl; | 317 | owarn << "No PIN has been defined! We consider it as a successful authentication though." << oendl; |
315 | return MultiauthPluginObject::Success; | 318 | return MultiauthPluginObject::Success; |
316 | } | 319 | } |
317 | 320 | ||
@@ -328,15 +331,15 @@ QString PinPlugin::pixmapNameConfig() const { | |||
328 | return "security/pinplugin"; | 331 | return "security/pinplugin"; |
329 | } | 332 | } |
330 | 333 | ||
331 | /// returns a PinConfigWidget | 334 | /// returns a PinConfigWidget |
332 | MultiauthConfigWidget * PinPlugin::configWidget(QWidget * parent) { | 335 | MultiauthConfigWidget * PinPlugin::configWidget(QWidget * parent) { |
333 | PinConfigWidget * pinw = new PinConfigWidget(parent, "PIN configuration widget"); | 336 | PinConfigWidget * pinw = new PinConfigWidget(parent, "PIN configuration widget"); |
334 | 337 | ||
335 | connect(pinw->changePIN, SIGNAL( clicked() ), this, SLOT( changePIN() )); | 338 | connect(pinw->changePIN, SIGNAL( clicked() ), this, SLOT( changePIN() )); |
336 | connect(pinw->clearPIN, SIGNAL( clicked() ), this, SLOT( clearPIN() )); | 339 | connect(pinw->clearPIN, SIGNAL( clicked() ), this, SLOT( clearPIN() )); |
337 | 340 | ||
338 | return pinw; | 341 | return pinw; |
339 | } | 342 | } |
340 | 343 | ||
341 | #include "pin.moc" | 344 | #include "pin.moc" |
342 | 345 | ||