History

repairs so OAuth flow doesn't get stuck after an error

Stephen Birarda committed 12 years ago

Commit 657bf6b1 parent 04e22492 files · +12 −0Browse files

Showing the changes to interface/src/ui/OAuthWebViewHandler.cpp (1 of 2 files). Show all

Unified · Split

interface/src/ui/OAuthWebViewHandler.cpp+11−0
@@ -109,6 +109,8 @@ void OAuthWebViewHandler::displayWebviewForAuthorizationURL(const QUrl& authoriz · 108 unmodified lines
109109
110110 connect(_activeWebView->page()->networkAccessManager(), &QNetworkAccessManager::sslErrors,
111111 this, &OAuthWebViewHandler::handleSSLErrors);
112+ connect(_activeWebView->page()->networkAccessManager(), &QNetworkAccessManager::finished,
113+ this, &OAuthWebViewHandler::handleReplyFinished);
112114 connect(_activeWebView.data(), &QWebView::loadFinished, this, &OAuthWebViewHandler::handleLoadFinished);
113115
114116 // connect to the destroyed signal so after the web view closes we can start a timer
@@ -132,6 +134,14 @@ void OAuthWebViewHandler::handleLoadFinished(bool success) { · 17 unmodified lines
132134 NodeList::getInstance()->setSessionUUID(QUuid(authQuery.queryItemValue(AUTH_STATE_QUERY_KEY)));
133135
134136 _activeWebView->close();
137+ _activeWebView = NULL;
138+ }
139+}
140+
141+void OAuthWebViewHandler::handleReplyFinished(QNetworkReply* reply) {
142+ if (_activeWebView && reply->error() != QNetworkReply::NoError) {
143+ qDebug() << "Error loading" << reply->url() << "-" << reply->errorString();
144+ _activeWebView->close();
135145 }
136146 }
137147
@@ -148,6 +158,7 @@ void OAuthWebViewHandler::handleURLChanged(const QUrl& url) { · 10 unmodified lines
148158 _activeWebView->show();
149159 } else if (url.toString() == DEFAULT_NODE_AUTH_URL.toString() + "/login") {
150160 // this is a login request - we're going to close the webview and signal the AccountManager that we need a login
161+ qDebug() << "data-server replied with login request. Signalling that login is required to proceed with OAuth.";
151162 _activeWebView->close();
152163 AccountManager::getInstance().checkAndSignalForAccessToken();
153164 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t