Skip to content

Commit

Permalink
review error cases for MuseScore.com login
Browse files Browse the repository at this point in the history
  • Loading branch information
lasconic committed Mar 11, 2015
1 parent 8d25783 commit d4e22ed
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
5 changes: 5 additions & 0 deletions mscore/loginmanager.cpp
Expand Up @@ -103,6 +103,10 @@ void LoginManager::onAuthorizedRequestDone()
QMessageBox::critical(0, tr("Network error"), tr("Please check your Internet connection"));
else if (_oauthManager->lastError() == KQOAuthManager::ContentOperationNotPermittedError)
QMessageBox::critical(0, tr("Please upgrade"), tr("Your MuseScore version is too old to use this feature.<br/> <a href=\"%1\">Please upgrade first</a>.").arg("http://musescore.org"));
else if (_oauthManager->lastError() == KQOAuthManager::RequestUnauthorized){
logout();
mscore->showLoginDialog();
}
}

/*------- TRY LOGIN ROUTINES ----------------------------*/
Expand Down Expand Up @@ -142,6 +146,7 @@ void LoginManager::onTryLoginError(const QString& error)
disconnect(this, SIGNAL(getUserSuccess()), this, SLOT(onTryLoginSuccess()));
disconnect(this, SIGNAL(getUserError(QString)), this, SLOT(onTryLoginError(QString)));
connect(this, SIGNAL(loginSuccess()), this, SLOT(tryLogin()));
logout();
mscore->showLoginDialog();
}
/*------- END - TRY LOGIN ROUTINES ----------------------------*/
Expand Down
16 changes: 7 additions & 9 deletions thirdparty/kQOAuth/kqoauthmanager.cpp
Expand Up @@ -586,13 +586,6 @@ void KQOAuthManager::onRequestReplyReceived() {
foreach (QNetworkCookie cookie , c)
qDebug() << cookie.name() << cookie.value();*/

// Just don't do anything if we didn't get anything useful.
if(networkReply.isEmpty()) {
reply->deleteLater();
return;
}
QMultiMap<QString, QString> responseTokens;

// We need to emit the signal even if we got an error.
if (d->error != KQOAuthManager::NoError) {
reply->deleteLater();
Expand All @@ -601,6 +594,13 @@ void KQOAuthManager::onRequestReplyReceived() {
return;
}

// Just don't do anything if we didn't get anything useful.
if(networkReply.isEmpty()) {
reply->deleteLater();
return;
}
QMultiMap<QString, QString> responseTokens;

responseTokens = d->createTokensFromResponse(networkReply);
d->opaqueRequest->clearRequest();
d->opaqueRequest->setHttpMethod(KQOAuthRequest::POST); // XXX FIXME: Convenient API does not support GET
Expand Down Expand Up @@ -671,8 +671,6 @@ void KQOAuthManager::onAuthorizedRequestReplyReceived() {
d->currentRequestType = d->r->requestType();
}



// Just don't do anything if we didn't get anything useful.
if(networkReply.isEmpty()) {
reply->deleteLater();
Expand Down

0 comments on commit d4e22ed

Please sign in to comment.