Commit bb2a7875 authored by Thomas Löffler's avatar Thomas Löffler
Browse files

Add validation of username to not allow capital chars

parent b386848d
Pipeline #4935 failed with stages
in 13 seconds
...@@ -69,6 +69,10 @@ class ServersideValidator extends \In2code\Femanager\Domain\Validator\Serverside ...@@ -69,6 +69,10 @@ class ServersideValidator extends \In2code\Femanager\Domain\Validator\Serverside
$this->checkUniqueInLdapValidation($user, $value, $validationSetting, $fieldName); $this->checkUniqueInLdapValidation($user, $value, $validationSetting, $fieldName);
break; break;
case 'lowerChars':
$this->checkLowerCharsValidation($user, $value, $validationSetting, $fieldName);
break;
case 'notInOldUserTable': case 'notInOldUserTable':
$this->notInOldUserTableValidation($user, $value, $validationSetting, $fieldName); $this->notInOldUserTableValidation($user, $value, $validationSetting, $fieldName);
break; break;
...@@ -122,6 +126,21 @@ class ServersideValidator extends \In2code\Femanager\Domain\Validator\Serverside ...@@ -122,6 +126,21 @@ class ServersideValidator extends \In2code\Femanager\Domain\Validator\Serverside
} }
} }
/**
* @param \In2code\Femanager\Domain\Model\User $user
* @param string $value
* @param array $validationSetting
* @param string $fieldName
* @return void
*/
protected function checkLowerCharsValidation($user, $value, $validationSetting, $fieldName)
{
if (preg_match('/[A-Z]/', $value) !== false) {
$this->addError(ucfirst($fieldName) . ' may not contain upper case characters!', $fieldName);
$this->isValid = false;
}
}
/** /**
* @param \In2code\Femanager\Domain\Model\User $user * @param \In2code\Femanager\Domain\Model\User $user
* @param $value * @param $value
......
...@@ -14,6 +14,7 @@ plugin.tx_femanager { ...@@ -14,6 +14,7 @@ plugin.tx_femanager {
uniqueInDb = 0 uniqueInDb = 0
uniqueInLdap = 1 uniqueInLdap = 1
notInOldUserTable = 1 notInOldUserTable = 1
lowerChars = 1
} }
password { password {
min = 12 min = 12
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment