From 398a6b2fc0f0b2fe03224d93b9b3155855936897 Mon Sep 17 00:00:00 2001 From: hydrogen Date: Sat, 5 Dec 2020 23:00:28 +0200 Subject: [PATCH] fix: make validity error match design --- ui/imports/Utils.qml | 3 +-- ui/onboarding/CreatePasswordModal.qml | 20 ++++++++++++++++++-- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/ui/imports/Utils.qml b/ui/imports/Utils.qml index 1c29ea4873..e0b3f6639a 100644 --- a/ui/imports/Utils.qml +++ b/ui/imports/Utils.qml @@ -214,8 +214,7 @@ QtObject { //% "You need to repeat your password" return [false, qsTrId("you-need-to-repeat-your-password")]; } else if (repeatPasswordField.text !== firstPasswordField.text) { - //% Both passwords must match - return [true, qsTrId("both-passwords-must-match")]; + return [false, qsTr("Passwords don't match")]; } return [true, ""]; diff --git a/ui/onboarding/CreatePasswordModal.qml b/ui/onboarding/CreatePasswordModal.qml index cbc950d036..5f2b1f2636 100644 --- a/ui/onboarding/CreatePasswordModal.qml +++ b/ui/onboarding/CreatePasswordModal.qml @@ -31,7 +31,6 @@ ModalPopup { //% "New password..." placeholderText: qsTrId("new-password...") textField.echoMode: TextInput.Password - validationError: popup.passwordValidationError onTextChanged: { [firstPasswordFieldValid, passwordValidationError] = Utils.validatePasswords("first", firstPasswordField, repeatPasswordField); @@ -50,7 +49,6 @@ ModalPopup { //% "Confirm password…" placeholderText: qsTrId("confirm-password…") textField.echoMode: TextInput.Password - validationError: popup.repeatPasswordValidationError Keys.onReturnPressed: { submitBtn.clicked() } @@ -60,6 +58,24 @@ ModalPopup { } } + StyledText { + id: validationError + text: { + if (passwordValidationError !== "") return passwordValidationError; + if (repeatPasswordValidationError !== "") return repeatPasswordValidationError; + return ""; + } + anchors.top: repeatPasswordField.bottom + anchors.topMargin: 20 + anchors.right: parent.right + anchors.rightMargin: Style.current.xlPadding + anchors.left: parent.left + anchors.leftMargin: Style.current.xlPadding + horizontalAlignment: Text.AlignHCenter + color: Style.current.danger + font.pixelSize: 11 + } + StyledText { //% "At least 6 characters. You will use this password to unlock status on this device & sign transactions." text: qsTrId("at-least-6-characters-you-will-use-this-password-to-unlock-status-on-this-device-sign-transactions.")