diff --git a/common/validators/UsernameValidator.php b/common/validators/UsernameValidator.php index f5d8895..11a8a0c 100644 --- a/common/validators/UsernameValidator.php +++ b/common/validators/UsernameValidator.php @@ -30,7 +30,7 @@ class UsernameValidator extends Validator { $length->tooShort = E::USERNAME_TOO_SHORT; $length->tooLong = E::USERNAME_TOO_LONG; - $pattern = new validators\RegularExpressionValidator(['pattern' => '/^[\p{L}\d-_\.!?#$%^&*()\[\]:;]+$/u']); + $pattern = new validators\RegularExpressionValidator(['pattern' => '/^[\p{L}\d-_\.!?$%^&*()\[\]:;]+$/u']); $pattern->message = E::USERNAME_INVALID; $unique = new validators\UniqueValidator(); diff --git a/tests/codeception/common/unit/validators/UsernameValidatorTest.php b/tests/codeception/common/unit/validators/UsernameValidatorTest.php index ecb8238..8ef0600 100644 --- a/tests/codeception/common/unit/validators/UsernameValidatorTest.php +++ b/tests/codeception/common/unit/validators/UsernameValidatorTest.php @@ -45,7 +45,7 @@ class UsernameValidatorTest extends TestCase { public function testValidateAttributePattern() { $shouldBeValid = [ - 'русский_ник', 'русский_ник_на_грани!', 'numbers1132', '*__*-Stars-*__*', '1-_.!?#$%^&*()[]', + 'русский_ник', 'русский_ник_на_грани!', 'numbers1132', '*__*-Stars-*__*', '1-_.!?$%^&*()[]', '[ESP]Эрик', 'Свят_помидор;', 'зроблена_ў_беларусі:)', ]; foreach($shouldBeValid as $nickname) { @@ -55,7 +55,7 @@ class UsernameValidatorTest extends TestCase { } $shouldBeInvalid = [ - 'nick@name', 'spaced nick', + 'nick@name', 'spaced nick', 'im#hashed' ]; foreach($shouldBeInvalid as $nickname) { $model = $this->createModel($nickname);