fix(@desktop/wallet): account name character limit not enforced
Closes #10281
This commit is contained in:
parent
b77c0f13a9
commit
1225a71877
|
@ -35,6 +35,7 @@ Item {
|
||||||
|
|
||||||
accountName.text = root.store.addAccountModule.accountName
|
accountName.text = root.store.addAccountModule.accountName
|
||||||
accountName.input.edit.forceActiveFocus()
|
accountName.input.edit.forceActiveFocus()
|
||||||
|
accountName.validate(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
QtObject {
|
QtObject {
|
||||||
|
@ -101,6 +102,7 @@ Item {
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
placeholderText: qsTr("Enter an account name...")
|
placeholderText: qsTr("Enter an account name...")
|
||||||
label: qsTr("Name")
|
label: qsTr("Name")
|
||||||
|
charLimit: 20
|
||||||
text: root.store.addAccountModule.accountName
|
text: root.store.addAccountModule.accountName
|
||||||
input.isIconSelectable: true
|
input.isIconSelectable: true
|
||||||
input.leftPadding: Style.current.padding
|
input.leftPadding: Style.current.padding
|
||||||
|
@ -120,6 +122,16 @@ Item {
|
||||||
d.openEmojiPopup(false)
|
d.openEmojiPopup(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
validators: [
|
||||||
|
StatusMinLengthValidator {
|
||||||
|
minLength: 1
|
||||||
|
errorMessage: Utils.getErrorMessage(accountName.errors, qsTr("wallet account name"))
|
||||||
|
},
|
||||||
|
StatusRegularExpressionValidator {
|
||||||
|
regularExpression: Constants.regularExpressions.alphanumerical
|
||||||
|
errorMessage: Constants.errorMessages.alphanumericalRegExp
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
onTextChanged: {
|
onTextChanged: {
|
||||||
root.store.addAccountModule.accountName = text
|
root.store.addAccountModule.accountName = text
|
||||||
|
@ -128,6 +140,10 @@ Item {
|
||||||
onKeyPressed: {
|
onKeyPressed: {
|
||||||
root.store.submitAddAccount(event)
|
root.store.submitAddAccount(event)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onValidChanged: {
|
||||||
|
root.store.accountNameIsValid = accountName.valid
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
StatusColorSelectorGrid {
|
StatusColorSelectorGrid {
|
||||||
|
|
|
@ -23,6 +23,7 @@ QtObject {
|
||||||
property bool editMode: root.addAccountModule.editMode
|
property bool editMode: root.addAccountModule.editMode
|
||||||
property bool disablePopup: root.addAccountModule.disablePopup
|
property bool disablePopup: root.addAccountModule.disablePopup
|
||||||
|
|
||||||
|
property bool accountNameIsValid: false
|
||||||
property bool enteredSeedPhraseIsValid: false
|
property bool enteredSeedPhraseIsValid: false
|
||||||
property bool enteredPrivateKeyIsValid: false
|
property bool enteredPrivateKeyIsValid: false
|
||||||
property bool addingNewMasterKeyConfirmed: false
|
property bool addingNewMasterKeyConfirmed: false
|
||||||
|
@ -195,7 +196,7 @@ QtObject {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (root.editMode) {
|
if (root.editMode) {
|
||||||
return root.addAccountModule.accountName !== "" &&
|
return root.accountNameIsValid &&
|
||||||
root.addAccountModule.accountName !== root.getStoredAccountName() ||
|
root.addAccountModule.accountName !== root.getStoredAccountName() ||
|
||||||
root.addAccountModule.selectedColor !== "" &&
|
root.addAccountModule.selectedColor !== "" &&
|
||||||
root.addAccountModule.selectedColor !== root.getStoredSelectedColor() ||
|
root.addAccountModule.selectedColor !== root.getStoredSelectedColor() ||
|
||||||
|
@ -203,7 +204,7 @@ QtObject {
|
||||||
root.addAccountModule.selectedEmoji !== root.getStoredSelectedEmoji()
|
root.addAccountModule.selectedEmoji !== root.getStoredSelectedEmoji()
|
||||||
}
|
}
|
||||||
|
|
||||||
let valid = root.addAccountModule.accountName !== "" &&
|
let valid = root.accountNameIsValid &&
|
||||||
root.addAccountModule.selectedColor !== "" &&
|
root.addAccountModule.selectedColor !== "" &&
|
||||||
root.addAccountModule.selectedEmoji !== ""
|
root.addAccountModule.selectedEmoji !== ""
|
||||||
|
|
||||||
|
|
|
@ -579,12 +579,14 @@ QtObject {
|
||||||
}
|
}
|
||||||
|
|
||||||
readonly property QtObject regularExpressions: QtObject {
|
readonly property QtObject regularExpressions: QtObject {
|
||||||
|
readonly property var alphanumerical: /^$|^[a-zA-Z0-9]+$/
|
||||||
readonly property var alphanumericalExpanded: /^$|^[a-zA-Z0-9\-_ ]+$/
|
readonly property var alphanumericalExpanded: /^$|^[a-zA-Z0-9\-_ ]+$/
|
||||||
readonly property var asciiPrintable: /^$|^[!-~]+$/
|
readonly property var asciiPrintable: /^$|^[!-~]+$/
|
||||||
readonly property var ascii: /^$|^[\x00-\x7F]+$/
|
readonly property var ascii: /^$|^[\x00-\x7F]+$/
|
||||||
}
|
}
|
||||||
|
|
||||||
readonly property QtObject errorMessages: QtObject {
|
readonly property QtObject errorMessages: QtObject {
|
||||||
|
readonly property string alphanumericalRegExp: qsTr("Only letters and numbers allowed")
|
||||||
readonly property string alphanumericalExpandedRegExp: qsTr("Only letters, numbers, underscores, whitespaces and hyphens allowed")
|
readonly property string alphanumericalExpandedRegExp: qsTr("Only letters, numbers, underscores, whitespaces and hyphens allowed")
|
||||||
readonly property string asciiRegExp: qsTr("Only letters, numbers and ASII characters allowed")
|
readonly property string asciiRegExp: qsTr("Only letters, numbers and ASII characters allowed")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue