From 39aebddf3b6b93091aa8494f74690b4a819593d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Fri, 13 Dec 2013 02:47:59 +0100 Subject: Add support for 1.7.4 user_type (needs testing with legacy accounts) --- logic/auth/flows/AuthenticateTask.cpp | 12 ++++++++---- logic/auth/flows/RefreshTask.cpp | 1 + 2 files changed, 9 insertions(+), 4 deletions(-) (limited to 'logic/auth/flows') diff --git a/logic/auth/flows/AuthenticateTask.cpp b/logic/auth/flows/AuthenticateTask.cpp index 966548ec..d8e5b624 100644 --- a/logic/auth/flows/AuthenticateTask.cpp +++ b/logic/auth/flows/AuthenticateTask.cpp @@ -76,7 +76,7 @@ bool AuthenticateTask::processResponse(QJsonObject responseData) // Read the response data. We need to get the client token, access token, and the selected // profile. QLOG_DEBUG() << "Processing authentication response."; - + QLOG_DEBUG() << responseData; // If we already have a client token, make sure the one the server gave us matches our // existing one. QLOG_DEBUG() << "Getting client token."; @@ -123,6 +123,7 @@ bool AuthenticateTask::processResponse(QJsonObject responseData) // Profiles are easy, we just need their ID and name. QString id = profile.value("id").toString(""); QString name = profile.value("name").toString(""); + bool legacy = profile.value("legacy").toBool(false); if (id.isEmpty() || name.isEmpty()) { @@ -134,7 +135,7 @@ bool AuthenticateTask::processResponse(QJsonObject responseData) } // Now, add a new AccountProfile entry to the list. - loadedProfiles.append({id, name}); + loadedProfiles.append({id, name, legacy}); } // Put the list of profiles we loaded into the MojangAccount object. m_account->m_profiles = loadedProfiles; @@ -166,10 +167,11 @@ bool AuthenticateTask::processResponse(QJsonObject responseData) // is it a good idea to log this? if (responseData.contains("user")) { + User u; auto obj = responseData.value("user").toObject(); - auto userId = obj.value("id").toString(); + u.id = obj.value("id").toString(); + QLOG_DEBUG() << "User ID: " << u.id ; auto propArray = obj.value("properties").toArray(); - QLOG_DEBUG() << "User ID: " << userId; QLOG_DEBUG() << "User Properties: "; for (auto prop : propArray) { @@ -177,7 +179,9 @@ bool AuthenticateTask::processResponse(QJsonObject responseData) auto name = propTuple.value("name").toString(); auto value = propTuple.value("value").toString(); QLOG_DEBUG() << name << " : " << value; + u.properties.insert(name, value); } + m_account->m_user = u; } // We've made it through the minefield of possible errors. Return true to indicate that diff --git a/logic/auth/flows/RefreshTask.cpp b/logic/auth/flows/RefreshTask.cpp index bd38eb10..d0ecf06e 100644 --- a/logic/auth/flows/RefreshTask.cpp +++ b/logic/auth/flows/RefreshTask.cpp @@ -67,6 +67,7 @@ bool RefreshTask::processResponse(QJsonObject responseData) // profile. QLOG_DEBUG() << "Processing authentication response."; + QLOG_DEBUG() << responseData; // If we already have a client token, make sure the one the server gave us matches our // existing one. QString clientToken = responseData.value("clientToken").toString(""); -- cgit v1.2.3 From 0af6f96c3de54c940799826ff6f3c89bb46f1540 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Fri, 13 Dec 2013 03:06:10 +0100 Subject: Do not log auth crud --- logic/auth/flows/AuthenticateTask.cpp | 2 +- logic/auth/flows/RefreshTask.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'logic/auth/flows') diff --git a/logic/auth/flows/AuthenticateTask.cpp b/logic/auth/flows/AuthenticateTask.cpp index d8e5b624..cc26cd1b 100644 --- a/logic/auth/flows/AuthenticateTask.cpp +++ b/logic/auth/flows/AuthenticateTask.cpp @@ -76,7 +76,7 @@ bool AuthenticateTask::processResponse(QJsonObject responseData) // Read the response data. We need to get the client token, access token, and the selected // profile. QLOG_DEBUG() << "Processing authentication response."; - QLOG_DEBUG() << responseData; + // QLOG_DEBUG() << responseData; // If we already have a client token, make sure the one the server gave us matches our // existing one. QLOG_DEBUG() << "Getting client token."; diff --git a/logic/auth/flows/RefreshTask.cpp b/logic/auth/flows/RefreshTask.cpp index d0ecf06e..16feac6e 100644 --- a/logic/auth/flows/RefreshTask.cpp +++ b/logic/auth/flows/RefreshTask.cpp @@ -67,7 +67,7 @@ bool RefreshTask::processResponse(QJsonObject responseData) // profile. QLOG_DEBUG() << "Processing authentication response."; - QLOG_DEBUG() << responseData; + // QLOG_DEBUG() << responseData; // If we already have a client token, make sure the one the server gave us matches our // existing one. QString clientToken = responseData.value("clientToken").toString(""); -- cgit v1.2.3