fix(MintTokensPanel): Update input fields validation

Closing: https://github.com/status-im/status-desktop/issues/9850
Password: 7 characters max, ascii printable characters
Name and description: ascii characters
This commit is contained in:
Alex Jbanca 2023-04-04 22:57:34 +03:00 committed by Alex Jbanca
parent 056dad2ce2
commit fb86d8745c
2 changed files with 9 additions and 3 deletions

View File

@ -109,9 +109,10 @@ StatusScrollView {
id: symbolInput id: symbolInput
label: qsTr("Token symbol") label: qsTr("Token symbol")
charLimit: 5 charLimit: 7
placeholderText: qsTr("Letter token abbreviation e.g. ABC") placeholderText: qsTr("Letter token abbreviation e.g. ABC")
errorText: qsTr("Token symbol") errorText: qsTr("Token symbol")
validator.regularExpression: Constants.regularExpressions.asciiPrintable
} }
CustomLabelDescriptionComponent { CustomLabelDescriptionComponent {
@ -189,6 +190,7 @@ StatusScrollView {
id: customInput id: customInput
property string errorText property string errorText
property alias validator: regexValidator
Layout.fillWidth: true Layout.fillWidth: true
validators: [ validators: [
@ -198,8 +200,9 @@ StatusScrollView {
customInput.errorText) customInput.errorText)
}, },
StatusRegularExpressionValidator { StatusRegularExpressionValidator {
regularExpression: Constants.regularExpressions.alphanumericalExpanded id: regexValidator
errorMessage: Constants.errorMessages.alphanumericalExpandedRegExp regularExpression: Constants.regularExpressions.ascii
errorMessage: Constants.errorMessages.asciiRegExp
} }
] ]
} }

View File

@ -580,10 +580,13 @@ QtObject {
readonly property QtObject regularExpressions: QtObject { readonly property QtObject regularExpressions: QtObject {
readonly property var alphanumericalExpanded: /^$|^[a-zA-Z0-9\-_ ]+$/ readonly property var alphanumericalExpanded: /^$|^[a-zA-Z0-9\-_ ]+$/
readonly property var asciiPrintable: /^$|^[!-~]+$/
readonly property var ascii: /^$|^[\x00-\x7F]+$/
} }
readonly property QtObject errorMessages: QtObject { readonly property QtObject errorMessages: QtObject {
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 QtObject socialLinkType: QtObject { readonly property QtObject socialLinkType: QtObject {