diff --git a/interface/resources/qml/LoginDialog/CompleteProfileBody.qml b/interface/resources/qml/LoginDialog/CompleteProfileBody.qml index 282295fe0b..ce5bdeae6d 100644 --- a/interface/resources/qml/LoginDialog/CompleteProfileBody.qml +++ b/interface/resources/qml/LoginDialog/CompleteProfileBody.qml @@ -22,6 +22,7 @@ Item { width: root.width height: root.height readonly property string termsContainerText: qsTr("By creating this user profile, you agree to High Fidelity's Terms of Service") + readonly property string termsContainerOculusText: qsTr("By signing up, you agree to High Fidelity's Terms of Service") readonly property int textFieldHeight: 31 readonly property string fontFamily: "Raleway" readonly property int fontSize: 15 @@ -86,8 +87,8 @@ Item { } Text { id: loginErrorMessage; - width: root.bannerWidth color: "red"; + width: root.bannerWidth; font.family: completeProfileBody.fontFamily font.pixelSize: 18 font.bold: completeProfileBody.fontBold @@ -97,7 +98,7 @@ Item { visible: true } Component.onCompleted: { - if (loginErrorMessageTextMetrics.width > root.bannerWidth && root.isTablet) { + if (loginErrorMessageTextMetrics.width > root.bannerWidth) { loginErrorMessage.wrapMode = Text.WordWrap; loginErrorMessage.verticalAlignment = Text.AlignLeft; loginErrorMessage.horizontalAlignment = Text.AlignLeft; @@ -326,7 +327,7 @@ Item { width: (parent.width - hifi.dimensions.contentSpacing.x) / 2 height: d.minHeightButton - text: qsTr("Create your profile") + text: completeProfileBody.withOculus ? qsTr("Sign Up") : qsTr("Create your profile") color: hifi.buttons.blue fontFamily: completeProfileBody.fontFamily @@ -344,15 +345,68 @@ Item { } Item { - id: additionalTextContainer + id: termsContainer width: parent.width - height: additionalTextMetrics.height + height: termsTextMetrics.height anchors { top: buttons.bottom horizontalCenter: parent.horizontalCenter topMargin: hifi.dimensions.contentSpacing.y left: parent.left } + TextMetrics { + id: termsTextMetrics + font: termsText.font + text: completeProfileBody.withOculus ? completeProfileBody.termsContainerOculusText : completeProfileBody.termsContainerText + Component.onCompleted: { + // with the link. + if (completeProfileBody.withOculus) { + termsText.text = qsTr("By signing up, you agree to High Fidelity's Terms of Service") + } else { + termsText.text = qsTr("By creating this user profile, you agree to High Fidelity's Terms of Service") + } + } + } + + HifiStylesUit.InfoItem { + id: termsText + text: completeProfileBody.withOculus ? completeProfileBody.termsContainerOculusText : completeProfileBody.termsContainerText + font.family: completeProfileBody.fontFamily + font.pixelSize: completeProfileBody.fontSize + font.bold: completeProfileBody.fontBold + wrapMode: Text.WordWrap + color: hifi.colors.white + linkColor: hifi.colors.blueAccent + lineHeight: 1 + lineHeightMode: Text.ProportionalHeight + + onLinkActivated: loginDialog.openUrl(link); + + Component.onCompleted: { + if (termsTextMetrics.width > root.bannerWidth) { + termsText.width = root.bannerWidth; + termsText.wrapMode = Text.WordWrap; + additionalText.verticalAlignment = Text.AlignLeft; + additionalText.horizontalAlignment = Text.AlignLeft; + termsContainer.height = (termsTextMetrics.width / root.bannerWidth) * termsTextMetrics.height; + termsContainer.anchors.left = buttons.left; + } else { + termsText.anchors.centerIn = termsContainer; + } + } + } + } + + Item { + id: additionalTextContainer + width: parent.width + height: additionalTextMetrics.height + anchors { + top: termsContainer.bottom + horizontalCenter: parent.horizontalCenter + topMargin: 2 * hifi.dimensions.contentSpacing.y + left: parent.left + } TextMetrics { id: additionalTextMetrics @@ -363,7 +417,7 @@ Item { HifiStylesUit.ShortcutText { id: additionalText text: "Already have a High Fidelity profile? Link to an existing profile here." - + width: root.bannerWidth; font.family: completeProfileBody.fontFamily font.pixelSize: completeProfileBody.fontSize font.bold: completeProfileBody.fontBold @@ -380,8 +434,7 @@ Item { "linkOculus": completeProfileBody.withOculus }); } Component.onCompleted: { - if (additionalTextMetrics.width > root.bannerWidth && root.isTablet) { - additionalText.width = root.bannerWidth; + if (additionalTextMetrics.width > root.bannerWidth) { additionalText.wrapMode = Text.WordWrap; additionalText.verticalAlignment = Text.AlignLeft; additionalText.horizontalAlignment = Text.AlignLeft; @@ -393,55 +446,6 @@ Item { } } } - - Item { - id: termsContainer - width: parent.width - height: termsTextMetrics.height - anchors { - top: additionalTextContainer.bottom - horizontalCenter: parent.horizontalCenter - topMargin: 2 * hifi.dimensions.contentSpacing.y - left: parent.left - } - TextMetrics { - id: termsTextMetrics - font: termsText.font - text: completeProfileBody.termsContainerText - Component.onCompleted: { - // with the link. - termsText.text = qsTr("By creating this user profile, you agree to High Fidelity's Terms of Service") - } - } - - HifiStylesUit.InfoItem { - id: termsText - text: completeProfileBody.termsContainerText - font.family: completeProfileBody.fontFamily - font.pixelSize: completeProfileBody.fontSize - font.bold: completeProfileBody.fontBold - wrapMode: Text.WordWrap - color: hifi.colors.lightGray - linkColor: hifi.colors.blueAccent - lineHeight: 1 - lineHeightMode: Text.ProportionalHeight - - onLinkActivated: loginDialog.openUrl(link); - - Component.onCompleted: { - if (termsTextMetrics.width > root.bannerWidth && root.isTablet) { - termsText.width = root.bannerWidth; - termsText.wrapMode = Text.WordWrap; - additionalText.verticalAlignment = Text.AlignLeft; - additionalText.horizontalAlignment = Text.AlignLeft; - termsContainer.height = (termsTextMetrics.width / root.bannerWidth) * termsTextMetrics.height; - termsContainer.anchors.left = buttons.left; - } else { - termsText.anchors.centerIn = termsContainer; - } - } - } - } } } @@ -463,7 +467,7 @@ Item { loginErrorMessage.visible = true; loginErrorMessage.text = error; - if (loginErrorMessageTextMetrics.width > root.bannerWidth && root.isTablet) { + if (loginErrorMessageTextMetrics.width > root.bannerWidth) { loginErrorMessage.wrapMode = Text.WordWrap; loginErrorMessage.verticalAlignment = Text.AlignLeft; loginErrorMessage.horizontalAlignment = Text.AlignLeft; @@ -487,5 +491,6 @@ Item { } d.resize(); root.text = ""; + usernameField.forceActiveFocus(); } } diff --git a/interface/resources/qml/LoginDialog/LoggingInBody.qml b/interface/resources/qml/LoginDialog/LoggingInBody.qml index d259da7c1c..2f7935d0cf 100644 --- a/interface/resources/qml/LoginDialog/LoggingInBody.qml +++ b/interface/resources/qml/LoginDialog/LoggingInBody.qml @@ -278,7 +278,7 @@ Item { bodyLoader.setSource("CompleteProfileBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader, "withSteam": loggingInBody.withSteam, "withOculus": loggingInBody.withOculus, "errorString": errorString }); } else if (loggingInBody.withOculus) { - errorString = "Your Oculus authentication has failed. Please make sure you are logged into Oculus and try again." + errorString = "Your Oculus account is not connected to an existing High Fidelity account. Please create a new one." bodyLoader.setSource("CompleteProfileBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader, "withSteam": loggingInBody.withSteam, "withOculus": loggingInBody.withOculus, "errorString": errorString }); } else { diff --git a/interface/resources/qml/LoginDialog/SignUpBody.qml b/interface/resources/qml/LoginDialog/SignUpBody.qml index 4e1887e33d..bb9c20161c 100644 --- a/interface/resources/qml/LoginDialog/SignUpBody.qml +++ b/interface/resources/qml/LoginDialog/SignUpBody.qml @@ -392,7 +392,7 @@ Item { font.pixelSize: signUpBody.fontSize font.bold: signUpBody.fontBold wrapMode: Text.WordWrap - color: hifi.colors.lightGray + color: hifi.colors.white linkColor: hifi.colors.blueAccent lineHeight: 1 lineHeightMode: Text.ProportionalHeight @@ -400,7 +400,7 @@ Item { onLinkActivated: loginDialog.openUrl(link); Component.onCompleted: { - if (termsTextMetrics.width > root.bannerWidth && root.isTablet) { + if (termsTextMetrics.width > root.bannerWidth) { termsText.width = root.bannerWidth; termsText.wrapMode = Text.WordWrap; additionalText.verticalAlignment = Text.AlignLeft; @@ -467,6 +467,7 @@ Item { loginErrorMessage.text = errorStringEdited; loginErrorMessageTextMetrics.text = errorString; if (loginErrorMessageTextMetrics.width > usernameField.width) { + loginErrorMessage.width = root.bannerWidth; loginErrorMessage.wrapMode = Text.WordWrap; loginErrorMessage.verticalAlignment = Text.AlignLeft; loginErrorMessage.horizontalAlignment = Text.AlignLeft; diff --git a/interface/resources/qml/LoginDialog/UsernameCollisionBody.qml b/interface/resources/qml/LoginDialog/UsernameCollisionBody.qml index b7b1a95e19..5ed2c0ea38 100644 --- a/interface/resources/qml/LoginDialog/UsernameCollisionBody.qml +++ b/interface/resources/qml/LoginDialog/UsernameCollisionBody.qml @@ -227,7 +227,7 @@ Item { font.pixelSize: usernameCollisionBody.fontSize font.bold: usernameCollisionBody.fontBold wrapMode: Text.WordWrap - color: hifi.colors.lightGray + color: hifi.colors.white linkColor: hifi.colors.blueAccent lineHeight: 1 lineHeightMode: Text.ProportionalHeight @@ -235,7 +235,7 @@ Item { onLinkActivated: loginDialog.openUrl(link); Component.onCompleted: { - if (termsTextMetrics.width > root.bannerWidth && root.isTablet) { + if (termsTextMetrics.width > root.bannerWidth) { termsText.width = root.bannerWidth; termsText.wrapMode = Text.WordWrap; additionalText.verticalAlignment = Text.AlignLeft; diff --git a/interface/src/ui/LoginDialog.cpp b/interface/src/ui/LoginDialog.cpp index b045db0d3c..5c009d9388 100644 --- a/interface/src/ui/LoginDialog.cpp +++ b/interface/src/ui/LoginDialog.cpp @@ -294,7 +294,6 @@ void LoginDialog::createCompleted(QNetworkReply* reply) { void LoginDialog::createFailed(QNetworkReply* reply) { if (isOculusRunning()) { auto replyData = reply->readAll(); - qDebug() << replyData; QJsonParseError parseError; auto doc = QJsonDocument::fromJson(replyData, &parseError); if (parseError.error != QJsonParseError::NoError) { @@ -307,21 +306,42 @@ void LoginDialog::createFailed(QNetworkReply* reply) { auto error = data.value("error").toObject(); auto identity = error.value("identity"); auto user = error.value("username"); - qDebug() << user.isArray() << " " << user.isObject() << " " << user.isString() << " " << user.isUndefined() << " " << user.isNull(); + auto email = error.value("email"); + QString usernameError; + QString emailError; + QString identityError; + QString errorReply; if (!user.isNull() && !user.isUndefined()) { QJsonArray arr = user.toArray(); if (!arr.isEmpty()) { - auto firstError = arr.at(0).toString(); - qDebug() << firstError; - emit handleCreateFailed("Username " + firstError); + usernameError = "Username " + arr.at(0).toString() + "."; } } - if (!identity.isNull()) { + if (!email.isNull() && !email.isUndefined()) { + QJsonArray arr = email.toArray(); + if (!arr.isEmpty()) { + emailError = "Email " + arr.at(0).toString() + "."; + } + } + if (!usernameError.isEmpty()) { + errorReply = usernameError; + if (!emailError.isEmpty()) { + errorReply.append(" " + emailError); + } + emit handleCreateFailed(errorReply); + return; + } + if (!emailError.isEmpty()) { + emit handleCreateFailed(emailError); + return; + } + + if (!identity.isNull() && !identity.isUndefined()) { QJsonArray arr = identity.toArray(); if (!arr.isEmpty()) { - auto firstError = arr.at(0).toString(); - qDebug() << firstError; - emit handleCreateFailed(firstError); + auto identityError = "Identity " + arr.at(0).toString() + "."; + emit handleCreateFailed(identityError); + return; } } }