deal with old authentication key with musescore.com

This commit is contained in:
lasconic 2014-11-22 18:04:07 +01:00
parent e4475c16d9
commit 37a2197efa
3 changed files with 15 additions and 6 deletions

View file

@ -101,6 +101,8 @@ void LoginManager::onAuthorizedRequestDone()
{
if (_oauthManager->lastError() == KQOAuthManager::NetworkError)
QMessageBox::critical(0, tr("Network error"), tr("Please check your internet connection"));
else if (_oauthManager->lastError() == KQOAuthManager::AuthenticationRequiredError)
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"));
}
/*------- TRY LOGIN ROUTINES ----------------------------*/
@ -209,6 +211,9 @@ void LoginManager::onAccessTokenRequestReady(QByteArray ba)
else if (_oauthManager->lastError() == KQOAuthManager::NetworkError) {
QMessageBox::critical(0, tr("Network error"), tr("Please check your internet connection"));
}
else if (_oauthManager->lastError() == KQOAuthManager::AuthenticationRequiredError) {
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"));
}
}
//---------------------------------------------------------

View file

@ -548,12 +548,13 @@ void KQOAuthManager::onRequestReplyReceived() {
break;
case QNetworkReply::ContentAccessDenied:
case QNetworkReply::AuthenticationRequiredError:
case QNetworkReply::UnknownContentError:
case QNetworkReply::ContentNotFoundError:
d->error = KQOAuthManager::RequestUnauthorized;
break;
case QNetworkReply::AuthenticationRequiredError:
d->error = KQOAuthManager::AuthenticationRequiredError;
break;
default:
d->error = KQOAuthManager::NetworkError;
break;
@ -636,12 +637,13 @@ void KQOAuthManager::onAuthorizedRequestReplyReceived() {
break;
case QNetworkReply::ContentAccessDenied:
case QNetworkReply::AuthenticationRequiredError:
case QNetworkReply::UnknownContentError:
case QNetworkReply::ContentNotFoundError:
d->error = KQOAuthManager::RequestUnauthorized;
break;
case QNetworkReply::AuthenticationRequiredError:
d->error = KQOAuthManager::AuthenticationRequiredError;
break;
default:
d->error = KQOAuthManager::NetworkError;
break;
@ -724,12 +726,13 @@ void KQOAuthManager::slotError(QNetworkReply::NetworkError error) {
break;
case QNetworkReply::ContentAccessDenied:
case QNetworkReply::AuthenticationRequiredError:
case QNetworkReply::UnknownContentError:
case QNetworkReply::ContentNotFoundError:
d->error = KQOAuthManager::RequestUnauthorized;
break;
case QNetworkReply::AuthenticationRequiredError:
d->error = KQOAuthManager::AuthenticationRequiredError;
break;
default:
d->error = KQOAuthManager::NetworkError;
break;

View file

@ -43,6 +43,7 @@ public:
RequestEndpointError, // Request endpoint is not valid.
RequestValidationError, // Request is not valid: some parameter missing?
RequestUnauthorized, // Authorization error: trying to access a resource without tokens.
AuthenticationRequiredError,// Authentication is required, key or auth is invalid
RequestError, // The given request to KQOAuthManager is invalid: NULL?,
ManagerError // Manager error, cannot use for sending requests.
};