fix(NicknamePopup): add support for Unicode nicknames

- do not restrict NicknamePopup's regexp to ASCII characters
- a similar thing could be done to the user's DisplayName but currently
  that's blocked on status-go side
- uses RXValidator from dotherside

Needs status-im/dotherside/pull/74
Fixes #8115
This commit is contained in:
Lukáš Tinkl 2022-11-15 08:17:35 +01:00 committed by Lukáš Tinkl
parent 47f7373838
commit 48f5a9d256
3 changed files with 10 additions and 5 deletions

View File

@ -28,7 +28,7 @@ StatusValidator {
id: root id: root
/*! /*!
\qmlproperty string StatusRegularExpressionValidator::regularExpression \qmlproperty var StatusRegularExpressionValidator::regularExpression
This property holds the regular expression used for validation. This property holds the regular expression used for validation.
Note that this property should be a regular expression in JS syntax, e.g /a/ for the regular expression matching "a". Note that this property should be a regular expression in JS syntax, e.g /a/ for the regular expression matching "a".
@ -50,11 +50,11 @@ StatusValidator {
property var regularExpression property var regularExpression
name: "regex" name: "regex"
errorMessage: `Must match regex(${validatorObj.regularExpression.toString()})` errorMessage: `Must match regex(${regularExpression.toString()})`
validatorObj: RegularExpressionValidator { regularExpression: root.regularExpression } validatorObj: RegularExpressionValidator { regularExpression: root.regularExpression }
validate: function (value) { validate: function (value) {
// Basic validation management // Basic validation management
return root.validatorObj.regularExpression.test(value) return root.regularExpression.test(value)
} }
} }

View File

@ -1,6 +1,8 @@
import QtQuick 2.13 import QtQuick 2.13
import QtQuick.Controls 2.13 import QtQuick.Controls 2.13
import DotherSide 0.1
import utils 1.0 import utils 1.0
import shared.controls 1.0 import shared.controls 1.0
@ -61,7 +63,10 @@ StatusModal {
validationMode: StatusInput.ValidationMode.IgnoreInvalidInput validationMode: StatusInput.ValidationMode.IgnoreInvalidInput
validators: [ validators: [
StatusRegularExpressionValidator { StatusRegularExpressionValidator {
regularExpression: /^[0-9A-Za-z_-]*$/ validatorObj: RXValidator { regularExpression: /^[\w\d_-]*$/u }
validate: function (value) {
return validatorObj.test(value)
}
} }
] ]
Keys.onReleased: { Keys.onReleased: {

2
vendor/DOtherSide vendored

@ -1 +1 @@
Subproject commit 328c56cee2cbf3c41619cda54d820a653483b498 Subproject commit 12907e411b5b5f1580a087f8235c7afc018f36e4