mirror of
https://github.com/elyby/accounts.git
synced 2024-11-26 16:52:02 +05:30
Больше нельзя устанавливать ники, содержащие в себе #
This commit is contained in:
parent
d3a2a37f11
commit
2b0023e13f
@ -30,7 +30,7 @@ class UsernameValidator extends Validator {
|
|||||||
$length->tooShort = E::USERNAME_TOO_SHORT;
|
$length->tooShort = E::USERNAME_TOO_SHORT;
|
||||||
$length->tooLong = E::USERNAME_TOO_LONG;
|
$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;
|
$pattern->message = E::USERNAME_INVALID;
|
||||||
|
|
||||||
$unique = new validators\UniqueValidator();
|
$unique = new validators\UniqueValidator();
|
||||||
|
@ -45,7 +45,7 @@ class UsernameValidatorTest extends TestCase {
|
|||||||
|
|
||||||
public function testValidateAttributePattern() {
|
public function testValidateAttributePattern() {
|
||||||
$shouldBeValid = [
|
$shouldBeValid = [
|
||||||
'русский_ник', 'русский_ник_на_грани!', 'numbers1132', '*__*-Stars-*__*', '1-_.!?#$%^&*()[]',
|
'русский_ник', 'русский_ник_на_грани!', 'numbers1132', '*__*-Stars-*__*', '1-_.!?$%^&*()[]',
|
||||||
'[ESP]Эрик', 'Свят_помидор;', 'зроблена_ў_беларусі:)',
|
'[ESP]Эрик', 'Свят_помидор;', 'зроблена_ў_беларусі:)',
|
||||||
];
|
];
|
||||||
foreach($shouldBeValid as $nickname) {
|
foreach($shouldBeValid as $nickname) {
|
||||||
@ -55,7 +55,7 @@ class UsernameValidatorTest extends TestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$shouldBeInvalid = [
|
$shouldBeInvalid = [
|
||||||
'nick@name', 'spaced nick',
|
'nick@name', 'spaced nick', 'im#hashed'
|
||||||
];
|
];
|
||||||
foreach($shouldBeInvalid as $nickname) {
|
foreach($shouldBeInvalid as $nickname) {
|
||||||
$model = $this->createModel($nickname);
|
$model = $this->createModel($nickname);
|
||||||
|
Loading…
Reference in New Issue
Block a user