Actually check if user has a Grooveshark account

This commit is contained in:
Arnaud Bienner 2011-10-05 21:02:32 +02:00
parent e77de84451
commit ea55ac67eb
1 changed files with 9 additions and 9 deletions

View File

@ -365,15 +365,15 @@ void GrooveSharkService::Authenticated() {
QVariantMap result = ExtractResult(reply); QVariantMap result = ExtractResult(reply);
// Check if the user has been authenticated correctly // Check if the user has been authenticated correctly
if (!result["success"].toBool()) { QString error;
QString error; if (!result["success"].toBool() || result["UserID"].toInt() == 0) {
if (result["UserID"].toInt() == 0) { error = tr("Invalid username and/or password");
error = tr("Invalid username and/or password"); login_state_ = LoginState_AuthFailed;
login_state_ = LoginState_AuthFailed; } else if(!result["IsAnywhere"].toBool() || !result["IsPremium"].toBool()) {
} else if(!result["IsAnywhere"].toBool() || !result["IsPremium"].toBool()) { error = tr("User %1 doesn't have a GrooveShark Anywhere account").arg(username_);
error = tr("It seems user %1 doesn't have a GrooveShark Anywhere account").arg(username_); login_state_ = LoginState_NoPremium;
login_state_ = LoginState_NoPremium; }
} if (!error.isEmpty()) {
QMessageBox::warning(NULL, tr("GrooveShark login error"), error, QMessageBox::Close); QMessageBox::warning(NULL, tr("GrooveShark login error"), error, QMessageBox::Close);
ResetSessionId(); ResetSessionId();
emit LoginFinished(false); emit LoginFinished(false);