Showing the changes to interface/src/ui/OAuthWebViewHandler.cpp (1 of 2 files). Show all
Unified · Split
| @@ -109,6 +109,8 @@ void OAuthWebViewHandler::displayWebviewForAuthorizationURL(const QUrl& authoriz · 108 unmodified lines | ||
| 109 | 109 | |
| 110 | 110 | connect(_activeWebView->page()->networkAccessManager(), &QNetworkAccessManager::sslErrors, |
| 111 | 111 | this, &OAuthWebViewHandler::handleSSLErrors); |
| 112 | + connect(_activeWebView->page()->networkAccessManager(), &QNetworkAccessManager::finished, | |
| 113 | + this, &OAuthWebViewHandler::handleReplyFinished); | |
| 112 | 114 | connect(_activeWebView.data(), &QWebView::loadFinished, this, &OAuthWebViewHandler::handleLoadFinished); |
| 113 | 115 | |
| 114 | 116 | // 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 | 134 | NodeList::getInstance()->setSessionUUID(QUuid(authQuery.queryItemValue(AUTH_STATE_QUERY_KEY))); |
| 133 | 135 | |
| 134 | 136 | _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(); | |
| 135 | 145 | } |
| 136 | 146 | } |
| 137 | 147 | |
| @@ -148,6 +158,7 @@ void OAuthWebViewHandler::handleURLChanged(const QUrl& url) { · 10 unmodified lines | ||
| 148 | 158 | _activeWebView->show(); |
| 149 | 159 | } else if (url.toString() == DEFAULT_NODE_AUTH_URL.toString() + "/login") { |
| 150 | 160 | // 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 | 162 | _activeWebView->close(); |
| 152 | 163 | AccountManager::getInstance().checkAndSignalForAccessToken(); |
| 153 | 164 | } |