Merge pull request #1057 from nextcloud/fix/proxy-login-flow

Fix login flow with system proxy
This commit is contained in:
Roeland Jago Douma 2019-01-31 16:11:08 +01:00 committed by GitHub
commit 822c386709
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 43 additions and 23 deletions

View file

@ -80,8 +80,16 @@ void ClientProxy::setupQtProxyFromConfig()
QNetworkProxy::setApplicationProxy(QNetworkProxy::NoProxy);
break;
case QNetworkProxy::DefaultProxy:
qCInfo(lcClientProxy) << "Set proxy configuration to use system configuration";
QNetworkProxyFactory::setUseSystemConfiguration(true);
qCInfo(lcClientProxy) << "Set proxy configuration to use the prefered system proxy for http tcp connections";
{
QNetworkProxyQuery query;
query.setProtocolTag("http");
query.setQueryType(QNetworkProxyQuery::TcpSocket);
auto proxies = QNetworkProxyFactory::proxyForQuery(query);
proxy = proxies.first();
}
QNetworkProxyFactory::setUseSystemConfiguration(false);
QNetworkProxy::setApplicationProxy(proxy);
break;
case QNetworkProxy::Socks5Proxy:
proxy.setType(QNetworkProxy::Socks5Proxy);

View file

@ -3,6 +3,7 @@
#include <QWebEngineUrlRequestJob>
#include <QProgressBar>
#include <QVBoxLayout>
#include <QNetworkProxyFactory>
#include "owncloudwizard.h"
#include "creds/webflowcredentials.h"
@ -27,9 +28,17 @@ WebViewPage::WebViewPage(QWidget *parent)
setLayout(layout);
connect(_webView, &WebView::urlCatched, this, &WebViewPage::urlCatched);
//_useSystemProxy = QNetworkProxyFactory::usesSystemConfiguration();
}
WebViewPage::~WebViewPage() {
//QNetworkProxyFactory::setUseSystemConfiguration(_useSystemProxy);
}
void WebViewPage::initializePage() {
//QNetworkProxy::setApplicationProxy(QNetworkProxy::applicationProxy());
QString url;
if (_ocWizard->registration()) {
url = "https://nextcloud.com/register";

View file

@ -14,6 +14,7 @@ class WebViewPage : public AbstractCredentialsWizardPage
Q_OBJECT
public:
WebViewPage(QWidget *parent = nullptr);
~WebViewPage();
void initializePage() override;
int nextId() const override;
@ -34,6 +35,8 @@ private:
QString _user;
QString _pass;
bool _useSystemProxy;
};
}