Skip to content

Commit

Permalink
Don't recommend to downgrade the connection
Browse files Browse the repository at this point in the history
Fixes: #8231
  • Loading branch information
TheOneRing committed Nov 26, 2020
1 parent 6ea9883 commit 460a07d
Show file tree
Hide file tree
Showing 12 changed files with 81 additions and 294 deletions.
6 changes: 6 additions & 0 deletions changelog/unreleased/8231
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Change: Don't ask the user to switch to http

We no longer recommend to use a http connection if a https url
was not found.

https://github.com/owncloud/client/issues/8231
4 changes: 1 addition & 3 deletions src/gui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,9 @@ set(client_UI_SRCS
notificationwidget.ui
logbrowser.ui
wizard/owncloudadvancedsetuppage.ui
wizard/owncloudconnectionmethoddialog.ui
wizard/owncloudhttpcredspage.ui
wizard/owncloudoauthcredspage.ui
wizard/owncloudsetupnocredspage.ui
wizard/owncloudsetuppage.ui
wizard/owncloudwizardresultpage.ui
)

Expand Down Expand Up @@ -92,7 +91,6 @@ set(client_SRCS
wizard/postfixlineedit.cpp
wizard/abstractcredswizardpage.cpp
wizard/owncloudadvancedsetuppage.cpp
wizard/owncloudconnectionmethoddialog.cpp
wizard/owncloudhttpcredspage.cpp
wizard/owncloudoauthcredspage.cpp
wizard/owncloudsetuppage.cpp
Expand Down
42 changes: 8 additions & 34 deletions src/gui/owncloudsetupwizard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,10 +256,9 @@ void OwncloudSetupWizard::slotNoServerFound(QNetworkReply *reply)
Utility::escape(_ocWizard->account()->url().toString()),
Utility::escape(job->errorString()));
}
bool isDowngradeAdvised = checkDowngradeAdvised(reply);

// Displays message inside wizard and possibly also another message box
_ocWizard->displayError(msg, isDowngradeAdvised);
_ocWizard->displayError(msg);

// Allow the credentials dialog to pop up again for the same URL.
// Maybe the user just clicked 'Cancel' by accident or changed his mind.
Expand All @@ -270,8 +269,7 @@ void OwncloudSetupWizard::slotNoServerFoundTimeout(const QUrl &url)
{
_ocWizard->displayError(
tr("Timeout while trying to connect to %1 at %2.")
.arg(Utility::escape(Theme::instance()->appNameGUI()), Utility::escape(url.toString())),
false);
.arg(Utility::escape(Theme::instance()->appNameGUI()), Utility::escape(url.toString())));
}

void OwncloudSetupWizard::slotDetermineAuthType()
Expand Down Expand Up @@ -378,30 +376,7 @@ void OwncloudSetupWizard::slotAuthError()
if (_ocWizard->currentId() == WizardCommon::Page_OAuthCreds) {
_ocWizard->back();
}
_ocWizard->displayError(errorMsg, _ocWizard->currentId() == WizardCommon::Page_ServerSetup && checkDowngradeAdvised(reply));
}

bool OwncloudSetupWizard::checkDowngradeAdvised(QNetworkReply *reply)
{
if (reply->url().scheme() != QLatin1String("https")) {
return false;
}

switch (reply->error()) {
case QNetworkReply::NoError:
case QNetworkReply::ContentNotFoundError:
case QNetworkReply::AuthenticationRequiredError:
case QNetworkReply::HostNotFoundError:
return false;
default:
break;
}

// Adhere to HSTS, even though we do not parse it properly
if (reply->hasRawHeader("Strict-Transport-Security")) {
return false;
}
return true;
_ocWizard->displayError(errorMsg);
}

void OwncloudSetupWizard::slotCreateLocalAndRemoteFolders(const QString &localFolder, const QString &remoteFolder)
Expand All @@ -427,7 +402,7 @@ void OwncloudSetupWizard::slotCreateLocalAndRemoteFolders(const QString &localFo
} else {
res += tr("failed.");
qCWarning(lcWizard) << "Failed to create " << fi.path();
_ocWizard->displayError(tr("Could not create local folder %1").arg(Utility::escape(localFolder)), false);
_ocWizard->displayError(tr("Could not create local folder %1").arg(Utility::escape(localFolder)));
nextStep = false;
}
_ocWizard->appendToConfigurationLog(res);
Expand Down Expand Up @@ -464,7 +439,7 @@ void OwncloudSetupWizard::slotRemoteFolderExists(QNetworkReply *reply)
}

if (!ok) {
_ocWizard->displayError(Utility::escape(error), false);
_ocWizard->displayError(Utility::escape(error));
}

finalizeSetup(ok);
Expand Down Expand Up @@ -492,21 +467,20 @@ void OwncloudSetupWizard::slotCreateRemoteFolderFinished(QNetworkReply::NetworkE
} else if (error == 202) {
_ocWizard->appendToConfigurationLog(tr("The remote folder %1 already exists. Connecting it for syncing.").arg(_remoteFolder));
} else if (error > 202 && error < 300) {
_ocWizard->displayError(tr("The folder creation resulted in HTTP error code %1").arg((int)error), false);
_ocWizard->displayError(tr("The folder creation resulted in HTTP error code %1").arg((int)error));

_ocWizard->appendToConfigurationLog(tr("The folder creation resulted in HTTP error code %1").arg((int)error));
} else if (error == QNetworkReply::OperationCanceledError) {
_ocWizard->displayError(tr("The remote folder creation failed because the provided credentials "
"are wrong!"
"<br/>Please go back and check your credentials.</p>"),
false);
"<br/>Please go back and check your credentials.</p>"));
_ocWizard->appendToConfigurationLog(tr("<p><font color=\"red\">Remote folder creation failed probably because the provided credentials are wrong.</font>"
"<br/>Please go back and check your credentials.</p>"));
_remoteFolder.clear();
success = false;
} else {
_ocWizard->appendToConfigurationLog(tr("Remote folder %1 creation failed with error <tt>%2</tt>.").arg(Utility::escape(_remoteFolder)).arg(error));
_ocWizard->displayError(tr("Remote folder %1 creation failed with error <tt>%2</tt>.").arg(Utility::escape(_remoteFolder)).arg(error), false);
_ocWizard->displayError(tr("Remote folder %1 creation failed with error <tt>%2</tt>.").arg(Utility::escape(_remoteFolder)).arg(error));
_remoteFolder.clear();
success = false;
}
Expand Down
1 change: 0 additions & 1 deletion src/gui/owncloudsetupwizard.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ private slots:
void finalizeSetup(bool);
bool ensureStartFromScratch(const QString &localFolder);
AccountState *applyAccountChanges();
bool checkDowngradeAdvised(QNetworkReply *reply);

OwncloudWizard *_ocWizard;
QString _initLocalFolder;
Expand Down
57 changes: 0 additions & 57 deletions src/gui/wizard/owncloudconnectionmethoddialog.cpp

This file was deleted.

60 changes: 0 additions & 60 deletions src/gui/wizard/owncloudconnectionmethoddialog.h

This file was deleted.

65 changes: 0 additions & 65 deletions src/gui/wizard/owncloudconnectionmethoddialog.ui

This file was deleted.

Loading

0 comments on commit 460a07d

Please sign in to comment.