concrete/src/Validator/PasswordValidatorServiceProvider.php
protected function applyStringRequirementValidators(ValidatorManagerInterface $manager)
    {
        $specialCharacters = (int) $this->config->get('concrete.user.password.required_special_characters', 0);
        $lowerCase = (int) $this->config->get('concrete.user.password.required_lower_case', 0);
        $upperCase = (int) $this->config->get('concrete.user.password.required_upper_case', 0);

        if ($specialCharacters) {
            $regex = "/([^a-zA-Z0-9].*){{$specialCharacters},}/";
            $requirement = t2('Must contain at least %d special character.', 'Must contain at least %d special characters.', $specialCharacters);

            $manager->setValidator('required_special_characters', $this->regexValidator($regex, $requirement));
        }

        if ($lowerCase) {
            $regex = "/([a-z].*){{$lowerCase},}/";
            $requirement = t2('Must contain at least %d lowercase character.', 'Must contain at least %d lowercase characters.', $lowerCase);

            $manager->setValidator('required_lower_case', $this->regexValidator($regex, $requirement));
        }

        if ($upperCase) {
            $regex = "/([A-Z].*){{$upperCase},}/";
            $requirement = t2('Must contain at least %d uppercase character.', 'Must contain at least %d uppercase characters.', $upperCase);

            $manager->setValidator('required_upper_case', $this->regexValidator($regex, $requirement));
        }
    }
protected function applyStringRequirementValidators(ValidatorManagerInterface $manager)
    {
        $specialCharacters = (int) $this->config->get('concrete.user.password.required_special_characters', 0);
        $lowerCase = (int) $this->config->get('concrete.user.password.required_lower_case', 0);
        $upperCase = (int) $this->config->get('concrete.user.password.required_upper_case', 0);

        if ($specialCharacters) {
            $regex = "/([^a-zA-Z0-9].*){{$specialCharacters},}/";
            $requirement = t2('Must contain at least %d special character.', 'Must contain at least %d special characters.', $specialCharacters);

            $manager->setValidator('required_special_characters', $this->regexValidator($regex, $requirement));
        }

        if ($lowerCase) {
            $regex = "/([a-z].*){{$lowerCase},}/";
            $requirement = t2('Must contain at least %d lowercase character.', 'Must contain at least %d lowercase characters.', $lowerCase);

            $manager->setValidator('required_lower_case', $this->regexValidator($regex, $requirement));
        }

        if ($upperCase) {
            $regex = "/([A-Z].*){{$upperCase},}/";
            $requirement = t2('Must contain at least %d uppercase character.', 'Must contain at least %d uppercase characters.', $upperCase);

            $manager->setValidator('required_upper_case', $this->regexValidator($regex, $requirement));
        }
    }
protected function applyStringRequirementValidators ( ValidatorManagerInterface $ manager ) { $ specialCharacters = ( int ) $ this -> config -> get ( 'concrete.user.password.required_special_characters' , 0 ) ; $ lowerCase = ( int ) $ this -> config -> get ( 'concrete.user.password.required_lower_case' , 0 ) ; $ upperCase = ( int ) $ this -> config -> get ( 'concrete.user.password.required_upper_case' , 0 ) ; if ( $ specialCharacters ) { $ regex = "/([^a-zA-Z0-9].*){{$specialCharacters},}/" ; $ requirement = t2 ( 'Must contain at least %d special character.' , 'Must contain at least %d special characters.' , $ specialCharacters ) ; $ manager -> setValidator ( 'required_special_characters' , $ this -> regexValidator ( $ regex , $ requirement ) ) ; } if ( $ lowerCase ) { $ regex = "/([a-z].*){{$lowerCase},}/" ; $ requirement = t2 ( 'Must contain at least %d lowercase character.' , 'Must contain at least %d lowercase characters.' , $ lowerCase ) ; $ manager -> setValidator ( 'required_lower_case' , $ this -> regexValidator ( $ regex , $ requirement ) ) ; } if ( $ upperCase ) { $ regex = "/([A-Z].*){{$upperCase},}/" ; $ requirement = t2 ( 'Must contain at least %d uppercase character.' , 'Must contain at least %d uppercase characters.' , $ upperCase ) ; $ manager -> setValidator ( 'required_upper_case' , $ this -> regexValidator ( $ regex , $ requirement ) ) ; } }
Apply validators that require specific substrings

@param \Concrete\Core\Validator\ValidatorManagerInterface $manager
Apply validators that require specific substrings