From 79ffc311e10d5f6f58b2908722b5e776afb52297 Mon Sep 17 00:00:00 2001 From: Wayne Chen Date: Thu, 17 Jan 2019 10:19:40 -0800 Subject: [PATCH] code cleanup + adding password error --- interface/src/ui/LoginDialog.cpp | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/interface/src/ui/LoginDialog.cpp b/interface/src/ui/LoginDialog.cpp index 85557d173b..50730bd623 100644 --- a/interface/src/ui/LoginDialog.cpp +++ b/interface/src/ui/LoginDialog.cpp @@ -311,7 +311,8 @@ void LoginDialog::createFailed(QNetworkReply* reply) { auto user = error.value("username"); auto uid = error.value("uid"); auto email = error.value("email"); - QString usernameError; + auto password = error.value("password"); + QString reply; QString emailError; if (!uid.isNull() && !uid.isUndefined()) { QJsonArray arr = uid.toArray(); @@ -323,29 +324,29 @@ void LoginDialog::createFailed(QNetworkReply* reply) { if (!user.isNull() && !user.isUndefined()) { QJsonArray arr = user.toArray(); if (!arr.isEmpty()) { - usernameError = "Username " + arr.at(0).toString() + "."; + reply = "Username " + arr.at(0).toString() + "."; } } if (!email.isNull() && !email.isUndefined()) { QJsonArray arr = email.toArray(); if (!arr.isEmpty()) { - emailError = "Email " + arr.at(0).toString() + "."; + reply.append((!reply.isEmpty()) ? " " : ""); + reply.append("Email " + arr.at(0).toString() + "."); } } - if (!usernameError.isEmpty()) { - if (!emailError.isEmpty()) { - usernameError.append(" " + emailError); + if (!password.isNull() && !password.isUndefined()) { + QJsonArray arr = password.toArray(); + if (!arr.isEmpty()) { + reply.append((!reply.isEmpty()) ? " " : ""); + reply.append("Password " + arr.at(0).toString() + "."); } - emit handleCreateFailed(usernameError); - return; - } - if (!emailError.isEmpty()) { - emit handleCreateFailed(emailError); - return; } if (!oculusError.isNull() && !oculusError.isUndefined()) { emit handleCreateFailed("Could not verify token with Oculus. Please try again."); return; + } else { + emit handleCreateFailed(reply); + return; } } emit handleCreateFailed(reply->errorString());