]> dgit.raspbian.org Git - nextcloud-desktop.git/commitdiff
Account wizard: Enable back button consistently #5107
authorChristian Kamm <mail@ckamm.de>
Tue, 23 Aug 2016 13:43:43 +0000 (15:43 +0200)
committerChristian Kamm <mail@ckamm.de>
Fri, 26 Aug 2016 11:12:25 +0000 (13:12 +0200)
Tested with http auth and shib auth.

src/gui/wizard/owncloudhttpcredspage.cpp
src/gui/wizard/owncloudhttpcredspage.h
src/gui/wizard/owncloudwizard.cpp

index d670b3cac4355552011d00f8b1aea57f4a0c63f2..4c33ed9d38adcd60b4b2401c4898528e405dd82f 100644 (file)
@@ -30,7 +30,6 @@ OwncloudHttpCredsPage::OwncloudHttpCredsPage(QWidget* parent)
   : AbstractCredentialsWizardPage(),
     _ui(),
     _connected(false),
-    _checking(false),
     _progressIndi(new QProgressIndicator (this))
 {
     _ui.setupUi(this);
@@ -133,14 +132,20 @@ bool OwncloudHttpCredsPage::validatePage()
 
     if (!_connected) {
         _ui.errorLabel->setVisible(false);
-        _checking = true;
         startSpinner();
+
+        // Reset cookies to ensure the username / password is actually used
+        OwncloudWizard* ocWizard = qobject_cast< OwncloudWizard* >(wizard());
+        ocWizard->account()->clearCookieJar();
+
         emit completeChanged();
         emit connectToOCUrl(field("OCUrl").toString().simplified());
 
         return false;
     } else {
-        _checking = false;
+        // Reset, to require another connection attempt next time
+        _connected = false;
+
         emit completeChanged();
         stopSpinner();
         return true;
@@ -153,9 +158,9 @@ int OwncloudHttpCredsPage::nextId() const
     return WizardCommon::Page_AdvancedSetup;
 }
 
-void OwncloudHttpCredsPage::setConnected( bool comp )
+void OwncloudHttpCredsPage::setConnected()
 {
-    _connected = comp;
+    _connected = true;
     stopSpinner ();
 }
 
@@ -181,7 +186,6 @@ void OwncloudHttpCredsPage::setErrorString(const QString& err)
         _ui.errorLabel->setVisible(true);
         _ui.errorLabel->setText(err);
     }
-    _checking = false;
     emit completeChanged();
     stopSpinner();
 }
index 2a40b54afaf27787dfd0ae73cbae54ed5827a60b..f339b23ec186ea3fac86d3f147985429a812d34b 100644 (file)
@@ -40,7 +40,7 @@ public:
   void cleanupPage() Q_DECL_OVERRIDE;
   bool validatePage() Q_DECL_OVERRIDE;
   int nextId() const Q_DECL_OVERRIDE;
-  void setConnected(bool connected);
+  void setConnected();
   void setErrorString( const QString& err );
 
 Q_SIGNALS:
@@ -53,7 +53,6 @@ private:
 
   Ui_OwncloudHttpCredsPage _ui;
   bool _connected;
-  bool _checking;
   QProgressIndicator* _progressIndi;
   OwncloudWizard* _ocWizard;
 };
index 946c7455837949ab7eea30cc7c52a8f0f6c468d8..2baa8c48896e74028c58eb36b754011260c3ce24 100644 (file)
@@ -125,7 +125,7 @@ void OwncloudWizard::successfulStep()
 
     switch (id) {
     case WizardCommon::Page_HttpCreds:
-        _httpCredsPage->setConnected(true);
+        _httpCredsPage->setConnected();
         break;
 
     case WizardCommon::Page_ShibbolethCreds:
@@ -172,12 +172,6 @@ void OwncloudWizard::slotCurrentPageChanged( int id )
     }
 
     setOption(QWizard::HaveCustomButton1, id == WizardCommon::Page_AdvancedSetup);
-
-    if (id == WizardCommon::Page_AdvancedSetup) {
-        // Going back from this page messes the state as the account is created already
-        button(QWizard::BackButton)->setDisabled(true);
-    }
-
 }
 
 void OwncloudWizard::displayError( const QString& msg, bool retryHTTPonly )