mirror of
https://github.com/humhub/humhub.git
synced 2025-01-17 22:28:51 +01:00
Fixed User module access
This commit is contained in:
parent
f8b8d912af
commit
3bb581f03c
@ -170,7 +170,7 @@ class User extends ContentContainerActiveRecord implements IdentityInterface, Se
|
||||
return $this->isEmailRequired();
|
||||
}],
|
||||
[['guid'], 'unique'],
|
||||
[['username'], 'validateForbiddenUsername', 'on' => [self::SCENARIO_REGISTRATION]],
|
||||
[['username'], 'validateForbiddenUsername', 'on' => [self::SCENARIO_REGISTRATION]],
|
||||
];
|
||||
}
|
||||
|
||||
@ -199,7 +199,10 @@ class User extends ContentContainerActiveRecord implements IdentityInterface, Se
|
||||
*/
|
||||
public function validateForbiddenUsername($attribute, $params)
|
||||
{
|
||||
if (in_array(strtolower($this->$attribute), Yii::$app->controller->module->forbiddenUsernames)){
|
||||
/** @var Module $module */
|
||||
$module = Yii::$app->getModule('user');
|
||||
|
||||
if (in_array(strtolower($this->$attribute), $module->forbiddenUsernames)) {
|
||||
$this->addError($attribute, Yii::t('UserModule.account', 'You cannot use this username.'));
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user