fix: make validity error match design

This commit is contained in:
hydrogen 2020-12-05 23:00:28 +02:00 committed by Iuri Matias
parent 12bdec6b39
commit 398a6b2fc0
2 changed files with 19 additions and 4 deletions

View File

@ -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, ""];

View File

@ -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.")