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
109 109
110 connect(_activeWebView->page()->networkAccessManager(), &QNetworkAccessManager::sslErrors,110 connect(_activeWebView->page()->networkAccessManager(), &QNetworkAccessManager::sslErrors,
111 this, &OAuthWebViewHandler::handleSSLErrors);111 this, &OAuthWebViewHandler::handleSSLErrors);
112 connect(_activeWebView->page()->networkAccessManager(), &QNetworkAccessManager::finished,
113 this, &OAuthWebViewHandler::handleReplyFinished);
112 connect(_activeWebView.data(), &QWebView::loadFinished, this, &OAuthWebViewHandler::handleLoadFinished);114 connect(_activeWebView.data(), &QWebView::loadFinished, this, &OAuthWebViewHandler::handleLoadFinished);
113 115
114 // connect to the destroyed signal so after the web view closes we can start a timer116 // 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
132 NodeList::getInstance()->setSessionUUID(QUuid(authQuery.queryItemValue(AUTH_STATE_QUERY_KEY)));134 NodeList::getInstance()->setSessionUUID(QUuid(authQuery.queryItemValue(AUTH_STATE_QUERY_KEY)));
133 135
134 _activeWebView->close();136 _activeWebView->close();
137 _activeWebView = NULL;
138 }
139}
140
141void OAuthWebViewHandler::handleReplyFinished(QNetworkReply* reply) {
142 if (_activeWebView && reply->error() != QNetworkReply::NoError) {
143 qDebug() << "Error loading" << reply->url() << "-" << reply->errorString();
144 _activeWebView->close();
135 }145 }
136}146}
137 147
@@ -148,6 +158,7 @@ void OAuthWebViewHandler::handleURLChanged(const QUrl& url) { · 10 unmodified lines
148 _activeWebView->show();158 _activeWebView->show();
149 } else if (url.toString() == DEFAULT_NODE_AUTH_URL.toString() + "/login") {159 } else if (url.toString() == DEFAULT_NODE_AUTH_URL.toString() + "/login") {
150 // this is a login request - we're going to close the webview and signal the AccountManager that we need a login160 // 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.";
151 _activeWebView->close();162 _activeWebView->close();
152 AccountManager::getInstance().checkAndSignalForAccessToken(); 163 AccountManager::getInstance().checkAndSignalForAccessToken();
153 }164 }

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