feat(@wallet): 5 chars min account keypair name

fixes #13384
This commit is contained in:
Anthony Laibe 2024-02-05 11:04:20 +01:00 committed by Anthony Laibe
parent a5b87314f7
commit 0916d1db2c
7 changed files with 32 additions and 9 deletions

View File

@ -69,15 +69,15 @@ StatusModal {
}
validators: [
StatusMinLengthValidator {
errorMessage: qsTr("You need to enter an account name")
minLength: 1
errorMessage: qsTr("Account name must be at least %n character(s)", "", Constants.addAccountPopup.keyPairAccountNameMinLength)
minLength: Constants.addAccountPopup.keyPairAccountNameMinLength
},
StatusRegularExpressionValidator {
regularExpression: /^[^<>]+$/
errorMessage: qsTr("This is not a valid account name")
}
]
charLimit: 40
charLimit: 20
}
StatusColorSelectorGrid {

View File

@ -5,6 +5,7 @@ import QtQuick.Layouts 1.14
import StatusQ.Core 0.1
import StatusQ.Core.Theme 0.1
import StatusQ.Controls 0.1
import StatusQ.Controls.Validators 0.1
import utils 1.0
@ -43,6 +44,13 @@ Item {
onKeyPressed: {
root.store.submitPopup(event)
}
validators: [
StatusMinLengthValidator {
errorMessage: qsTr("Keypair name must be at least %n character(s)", "", Constants.addAccountPopup.keyPairAccountNameMinLength)
minLength: Constants.addAccountPopup.keyPairAccountNameMinLength
}
]
}
StatusBaseText {

View File

@ -126,8 +126,8 @@ Item {
}
validators: [
StatusMinLengthValidator {
minLength: 1
errorMessage: Utils.getErrorMessage(accountName.errors, qsTr("wallet account name"))
errorMessage: qsTr("Account name must be at least %n character(s)", "", Constants.addAccountPopup.keyPairAccountNameMinLength)
minLength: Constants.addAccountPopup.keyPairAccountNameMinLength
},
StatusRegularExpressionValidator {
regularExpression: Constants.regularExpressions.alphanumericalWithSpace

View File

@ -236,7 +236,7 @@ BasePopupStore {
root.privateKeyAccAddress.loaded &&
!root.privateKeyAccAddress.alreadyCreated &&
root.privateKeyAccAddress.address !== "" &&
root.addAccountModule.newKeyPairName !== ""
root.addAccountModule.newKeyPairName.length >= Constants.addAccountPopup.keyPairAccountNameMinLength
}
}
@ -246,12 +246,12 @@ BasePopupStore {
root.privateKeyAccAddress.loaded &&
!root.privateKeyAccAddress.alreadyCreated &&
root.privateKeyAccAddress.address !== "" &&
root.addAccountModule.newKeyPairName !== ""
root.addAccountModule.newKeyPairName.length >= Constants.addAccountPopup.keyPairAccountNameMinLength
}
if (root.currentState.stateType === Constants.addAccountPopup.state.enterSeedPhrase) {
return root.enteredSeedPhraseIsValid &&
root.addAccountModule.newKeyPairName !== ""
root.addAccountModule.newKeyPairName.length >= Constants.addAccountPopup.keyPairAccountNameMinLength
}
@ -276,7 +276,7 @@ BasePopupStore {
}
if (root.currentState.stateType === Constants.addAccountPopup.state.enterKeypairName) {
return root.addAccountModule.newKeyPairName !== ""
return root.addAccountModule.newKeyPairName.length >= Constants.addAccountPopup.keyPairAccountNameMinLength
}
return true

View File

@ -176,6 +176,13 @@ Item {
onKeyPressed: {
root.store.submitPopup(event)
}
validators: [
StatusMinLengthValidator {
errorMessage: qsTr("Keypair name must be at least %n character(s)", "", Constants.addAccountPopup.keyPairAccountNameMinLength)
minLength: Constants.addAccountPopup.keyPairAccountNameMinLength
}
]
}
StatusBaseText {

View File

@ -88,6 +88,13 @@ Item {
root.store.addAccountModule.newKeyPairName = text
}
validators: [
StatusMinLengthValidator {
errorMessage: qsTr("Keypair name must be at least %n character(s)", "", Constants.addAccountPopup.keyPairAccountNameMinLength)
minLength: Constants.addAccountPopup.keyPairAccountNameMinLength
}
]
onKeyPressed: {
root.store.submitPopup(event)
}

View File

@ -733,6 +733,7 @@ QtObject {
readonly property int labelFontSize2: 13
readonly property int footerButtonsHeight: 44
readonly property int keyPairNameMaxLength: 20
readonly property int keyPairAccountNameMinLength: 5
readonly property int stepperWidth: 242
readonly property int stepperHeight: 30