Deny slashes in usernames (#4780)

This commit is contained in:
Yuriy Bakhtin 2021-01-18 13:05:18 +03:00 committed by GitHub
parent 5c20ca98eb
commit 2bdc435486
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 3 deletions

View File

@ -14,7 +14,8 @@ HumHub Changelog
- Fix #4715: Call to `Content::canArchive()` throws error on global content
- Fix #4744: Banner image orientation not being processed
- Fix #4743: Hide "Like" link when no permission "Can like"
- Fix #4768: Use only letters and digits from Space name for logo acronym (Thanks to @jrckmcsb)
- Fix #4768: Use only letters and digits from Space name for logo acronym (Thanks to @jrckmcsb)
- Fix #3617: Deny slashes in usernames
1.7.1 (November 27, 2020)

View File

@ -148,7 +148,7 @@ class User extends ContentContainerActiveRecord implements IdentityInterface, Se
[['username'], 'unique'],
[['username'], 'string', 'max' => $userModule->maximumUsernameLength, 'min' => $userModule->minimumUsernameLength],
// Client validation is disable due to invalid client pattern validation
[['username'], 'match', 'not' => true, 'pattern' => '/[\x00-\x1f\x7f]/', 'message' => Yii::t('UserModule.base', 'Username contains invalid characters.'), 'enableClientValidation' => false],
[['username'], 'match', 'not' => true, 'pattern' => '/[\x00-\x1f\x7f\/]/', 'message' => Yii::t('UserModule.base', 'Username contains invalid characters.'), 'enableClientValidation' => false],
[['status', 'created_by', 'updated_by', 'visibility'], 'integer'],
[['tags'], 'string'],
[['guid'], 'string', 'max' => 45],

View File

@ -41,7 +41,7 @@ class AccountChangeUsername extends \yii\base\Model
['newUsername', 'required'],
['newUsername', 'string', 'min' => $userModule->minimumUsernameLength, 'max' => $userModule->maximumUsernameLength],
['newUsername', 'unique', 'targetAttribute' => 'username', 'targetClass' => User::class, 'message' => '{attribute} "{value}" is already in use!'],
['newUsername', 'match', 'not' => true, 'pattern' => '/[\x00-\x1f\x7f]/', 'message' => Yii::t('UserModule.base', 'Username contains invalid characters.'), 'enableClientValidation' => false],
['newUsername', 'match', 'not' => true, 'pattern' => '/[\x00-\x1f\x7f\/]/', 'message' => Yii::t('UserModule.base', 'Username contains invalid characters.'), 'enableClientValidation' => false],
['newUsername', 'trim'],
];