summaryrefslogtreecommitdiff
path: root/libopie2/opiesecurity
authorclem <clem>2004-10-05 23:38:06 (UTC)
committer clem <clem>2004-10-05 23:38:06 (UTC)
commitc09e45b02053c61b4e195c9d79a573ebfed2c521 (patch) (unidiff)
tree504a1a7d6b29e9dc186b2a7a7431ea41482041e3 /libopie2/opiesecurity
parent2d05ffb4bad93532e17b9350ff2d66fe3419cbe3 (diff)
downloadopie-c09e45b02053c61b4e195c9d79a573ebfed2c521.zip
opie-c09e45b02053c61b4e195c9d79a573ebfed2c521.tar.gz
opie-c09e45b02053c61b4e195c9d79a573ebfed2c521.tar.bz2
Changed the way to test authentication: instead of having a hardcoded config
option, allowByPass, we now have a "Test now" button in the configuration interface. We add to change both the config app and the libopie2security files for that, since the MultiauthMainWindow constructor has to know whether to implement a debug mode (with an new argument, false by default). We also had to give MultiauthGeneralConfig a link to MultiauthConfig, since the test button triggers the writing of the whole configuration. Some cleaning too (m_ on *all* member attributes, removal of obsolete allowByPass / explanScreens checking code.
Diffstat (limited to 'libopie2/opiesecurity') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiesecurity/multiauthmainwindow.cpp29
-rw-r--r--libopie2/opiesecurity/multiauthmainwindow.h2
2 files changed, 20 insertions, 11 deletions
diff --git a/libopie2/opiesecurity/multiauthmainwindow.cpp b/libopie2/opiesecurity/multiauthmainwindow.cpp
index fa247ab..fb720bb 100644
--- a/libopie2/opiesecurity/multiauthmainwindow.cpp
+++ b/libopie2/opiesecurity/multiauthmainwindow.cpp
@@ -1,36 +1,43 @@
1#include "multiauthmainwindow.h" 1#include "multiauthmainwindow.h"
2 2
3#include "multiauthcommon.h" 3#include "multiauthcommon.h"
4#include <qpe/config.h> 4#include <qpe/config.h>
5 5
6namespace Opie { 6namespace Opie {
7namespace Security { 7namespace Security {
8 8
9/// Initializes widgets according to allowBypass and explanScreens config 9/// Initializes widgets according to allowBypass argument (false by default) and explanScreens config
10MultiauthMainWindow::MultiauthMainWindow() 10/**
11 * \note if allowBypass is true, we will show explanatory screens anyway
12 */
13MultiauthMainWindow::MultiauthMainWindow(bool allowBypass = false)
11 : QDialog(0, "main Opie multiauth modal dialog", TRUE, 14 : QDialog(0, "main Opie multiauth modal dialog", TRUE,
12 Qt::WStyle_NoBorder | Qt::WStyle_Customize | Qt::WStyle_StaysOnTop) 15 Qt::WStyle_NoBorder | Qt::WStyle_Customize | Qt::WStyle_StaysOnTop)
13 16
14{ 17{
15 alreadyDone = false; 18 alreadyDone = false;
16 // initializes widget pointers which not always point to an object 19 // initializes widget pointers which not always point to an object
17 quit = 0; 20 quit = 0;
18 message2 = 0; 21 message2 = 0;
19 22
20 Config *pcfg = new Config("Security"); 23 if (allowBypass == true)
21 pcfg->setGroup("Misc"); 24 explanScreens = true;
22 explanScreens = pcfg->readBoolEntry("explanScreens", true); 25 else
23 allowBypass = pcfg->readBoolEntry("allowBypass", false); 26 {
24 delete pcfg; 27 Config *pcfg = new Config("Security");
28 pcfg->setGroup("Misc");
29 explanScreens = pcfg->readBoolEntry("explanScreens", true);
30 delete pcfg;
31 }
25 32
26 layout = new QVBoxLayout(this); 33 layout = new QVBoxLayout(this);
27 layout->setSpacing(11); 34 layout->setSpacing(11);
28 layout->setMargin(11); 35 layout->setMargin(11);
29 layout->setAlignment( Qt::AlignTop ); 36 layout->setAlignment( Qt::AlignTop );
30 37
31 // if explanScreens is false, we don't show any text in the QDialog, 38 // if explanScreens is false, we don't show any text in the QDialog,
32 // and we proceed directly 39 // and we proceed directly
33 if ( explanScreens == true ) 40 if ( explanScreens == true )
34 { 41 {
35 title = new QLabel("<center><h1>" + tr("Welcome to Opie Multi-authentication Framework") + "</h1></center>", this); 42 title = new QLabel("<center><h1>" + tr("Welcome to Opie Multi-authentication Framework") + "</h1></center>", this);
36 message = new QLabel("<center><h3>" + tr("Launching authentication plugins...") + "</h3></center>", this); 43 message = new QLabel("<center><h3>" + tr("Launching authentication plugins...") + "</h3></center>", this);
@@ -44,25 +51,25 @@ MultiauthMainWindow::MultiauthMainWindow()
44 proceedButton = new QPushButton(tr("Proceed..."), this); 51 proceedButton = new QPushButton(tr("Proceed..."), this);
45 layout->addWidget(proceedButton, 0, Qt::AlignHCenter); 52 layout->addWidget(proceedButton, 0, Qt::AlignHCenter);
46 53
47 QObject::connect(proceedButton, SIGNAL(clicked()), this, SLOT(proceed())); 54 QObject::connect(proceedButton, SIGNAL(clicked()), this, SLOT(proceed()));
48 55
49 if ( explanScreens == true ) 56 if ( explanScreens == true )
50 { 57 {
51 quit = new QPushButton("Exit", this); 58 quit = new QPushButton("Exit", this);
52 layout->addWidget(quit, 0, Qt::AlignHCenter); 59 layout->addWidget(quit, 0, Qt::AlignHCenter);
53 if ( allowBypass == true ) 60 if ( allowBypass == true )
54 { 61 {
55 // very important: we can close the widget through the quit button, and bypass authentication, only if allowBypass is set! 62 // very important: we can close the widget through the quit button, and bypass authentication, only if allowBypass is set!
56 message2 = new QLabel("<center><i>" + tr("Note: the 'exit' button should be removed for real protection, through Security config dialog") + ".</i></center>", this); 63 message2 = new QLabel("<center><i>" + tr("Note: this 'exit' button only appears during <b>simulations</b>, like the one we are in.") + "</i></center>", this);
57 layout->addWidget(message2); 64 layout->addWidget(message2);
58 QObject::connect(quit, SIGNAL(clicked()), this, SLOT(close())); 65 QObject::connect(quit, SIGNAL(clicked()), this, SLOT(close()));
59 } 66 }
60 else 67 else
61 { 68 {
62 quit->hide(); 69 quit->hide();
63 } 70 }
64 71
65 } 72 }
66 else 73 else
67 { 74 {
68 // we will need this button only if runPlugins() fails in proceed() 75 // we will need this button only if runPlugins() fails in proceed()
@@ -105,28 +112,30 @@ void MultiauthMainWindow::proceed() {
105 if ( quit->isHidden() ) 112 if ( quit->isHidden() )
106 { 113 {
107 // that means we don't allow to bypass, but now we can show and connect this button 114 // that means we don't allow to bypass, but now we can show and connect this button
108 QObject::connect(quit, SIGNAL(clicked()), this, SLOT(close())); 115 QObject::connect(quit, SIGNAL(clicked()), this, SLOT(close()));
109 quit->show(); 116 quit->show();
110 } else { 117 } else {
111 if ( message2 != 0 ) message2->hide(); 118 if ( message2 != 0 ) message2->hide();
112 } 119 }
113 } 120 }
114 else 121 else
115 { 122 {
116 // authentication has failed, explain that according to allowBypass 123 // authentication has failed, explain that according to allowBypass
117 message->setText( "<center><h3>" + tr("You have not succeeded enough authentication steps!") + "</h3></center>" ); 124 message->setText( "<center><h3>" + tr("You have <b>not</b> succeeded enough authentication steps!") + "</h3></center>" );
118 proceedButton->show(); 125 proceedButton->show();
119 if ( allowBypass == true ) 126 if ( allowBypass == true )
120 message2->setText( "<center><p>" + tr("Note: if 'allow to bypass' was uncheck in Security config, you would have to go back through all the steps now.") + "</p></center>" ); 127 {
128 message2->setText( "<center><p>" + tr("Be careful: if this was not a <b>simulation</b>, you would have to go back through all the steps now.") + "</p></center>" );
129 message2->show();
121 } 130 }
122 } 131 }
123} 132}
124 133
125/** When we don't show explanatory screens and we succeed authentication, 134/** When we don't show explanatory screens and we succeed authentication,
126 * as early as during the proceed() call of the constructor, the caller must know 135 * as early as during the proceed() call of the constructor, the caller must know
127 * (through this function) authentication has already been succeeded.. 136 * (through this function) authentication has already been succeeded..
128 * \todo try to avoid this hack? 137 * \todo try to avoid this hack?
129 */ 138 */
130bool MultiauthMainWindow::isAlreadyDone() { 139bool MultiauthMainWindow::isAlreadyDone() {
131 return alreadyDone; 140 return alreadyDone;
132} 141}
diff --git a/libopie2/opiesecurity/multiauthmainwindow.h b/libopie2/opiesecurity/multiauthmainwindow.h
index 626b8b3..9d2376b 100644
--- a/libopie2/opiesecurity/multiauthmainwindow.h
+++ b/libopie2/opiesecurity/multiauthmainwindow.h
@@ -46,25 +46,25 @@ namespace Opie {
46namespace Security { 46namespace Security {
47 47
48/// Multiauth main window 48/// Multiauth main window
49/** 49/**
50 * This QDialog window displays some information and an exit button, 50 * This QDialog window displays some information and an exit button,
51 * and completely hides the desktop, preventing user interactions 51 * and completely hides the desktop, preventing user interactions
52 * with it. 52 * with it.
53 */ 53 */
54class MultiauthMainWindow : public QDialog { 54class MultiauthMainWindow : public QDialog {
55 Q_OBJECT 55 Q_OBJECT
56 56
57 public: 57 public:
58 MultiauthMainWindow(); 58 MultiauthMainWindow(bool allowBypass = false);
59 ~MultiauthMainWindow(); 59 ~MultiauthMainWindow();
60 bool isAlreadyDone(); 60 bool isAlreadyDone();
61 61
62 private: 62 private:
63 QVBoxLayout * layout; 63 QVBoxLayout * layout;
64 QLabel * title, * message, * message2; 64 QLabel * title, * message, * message2;
65 QPushButton * proceedButton, * quit; 65 QPushButton * proceedButton, * quit;
66 /// whether to show explanatory screens before and after the authentication plugins 66 /// whether to show explanatory screens before and after the authentication plugins
67 bool explanScreens; 67 bool explanScreens;
68 /// allow to bypass authnentication via 'exit' buttons on both explan. screens 68 /// allow to bypass authnentication via 'exit' buttons on both explan. screens
69 bool allowBypass; 69 bool allowBypass;
70 /// true when the authentication has been done successfully 70 /// true when the authentication has been done successfully