Fix some wrong references
This commit is contained in:
8 files changed
+22
-15
No files matched your search
@@ -17,6 +17,7 @@ use Contao\FrontendUser;
|
||||
use Contao\Input;
|
||||
use Contao\MemberModel;
|
||||
use Contao\PageModel;
|
||||
use Doctrine\DBAL\DBALException;
|
||||
use Message;
|
||||
use Terminal42\PasswordValidationBundle\Validation\ValidationConfiguration;
|
||||
|
||||
@@ -43,7 +44,12 @@ final class NoPwChangePageWarning
|
||||
}
|
||||
|
||||
if (!$needsPwChangePage) {
|
||||
$members = MemberModel::findBy('pwChange', '1');
|
||||
try {
|
||||
$members = MemberModel::findBy('pwChange', '1');
|
||||
} catch (DBALException $e) {
|
||||
$members = null;
|
||||
}
|
||||
|
||||
if (null !== $members) {
|
||||
$needsPwChangePage = true;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ use Contao\BackendUser;
|
||||
use Contao\FrontendUser;
|
||||
use Contao\Widget;
|
||||
use ParagonIE\HiddenString\HiddenString;
|
||||
use Symfony\Component\Validator\Exception\ValidatorException;
|
||||
use Terminal42\PasswordValidationBundle\Exception\PasswordValidatorException;
|
||||
use Terminal42\PasswordValidationBundle\Validation\ValidationConfiguration;
|
||||
use Terminal42\PasswordValidationBundle\Validation\ValidationContext;
|
||||
use Terminal42\PasswordValidationBundle\Validation\ValidatorManager;
|
||||
@@ -75,7 +75,7 @@ final class PasswordRegexpListener
|
||||
|
||||
return true;
|
||||
}
|
||||
} catch (ValidatorException $e) {
|
||||
} catch (PasswordValidatorException $e) {
|
||||
$widget->addError($e->getMessage());
|
||||
|
||||
return true;
|
||||
|
||||
@@ -31,6 +31,7 @@ services:
|
||||
|
||||
terminal42_password_validation.listener.password_change_frontend:
|
||||
class: Terminal42\PasswordValidationBundle\EventListener\PasswordChangeFrontendListener
|
||||
public: true
|
||||
arguments:
|
||||
- '@contao.framework'
|
||||
- '@security.token_storage'
|
||||
|
||||
@@ -13,14 +13,14 @@ declare(strict_types=1);
|
||||
|
||||
namespace Terminal42\PasswordValidationBundle\Validation;
|
||||
|
||||
use Symfony\Component\Validator\Exception\ValidatorException;
|
||||
use Terminal42\PasswordValidationBundle\Exception\PasswordValidatorException;
|
||||
|
||||
interface PasswordValidatorInterface
|
||||
{
|
||||
/**
|
||||
* @param ValidationContext $context holds the password to verify, the user id and the like
|
||||
*
|
||||
* @throws ValidatorException to decline the password and add a error message to the password widget
|
||||
* @throws PasswordValidatorException to decline the password and add a error message to the password widget
|
||||
*
|
||||
* @return bool true to accept the password, false to decline the password
|
||||
*/
|
||||
|
||||
@@ -14,7 +14,7 @@ declare(strict_types=1);
|
||||
namespace Terminal42\PasswordValidationBundle\Validation\Validator;
|
||||
|
||||
use Contao\System;
|
||||
use Symfony\Component\Validator\Exception\ValidatorException;
|
||||
use Terminal42\PasswordValidationBundle\Exception\PasswordValidatorException;
|
||||
use Terminal42\PasswordValidationBundle\Validation\PasswordValidatorInterface;
|
||||
use Terminal42\PasswordValidationBundle\Validation\ValidationConfiguration;
|
||||
use Terminal42\PasswordValidationBundle\Validation\ValidationContext;
|
||||
@@ -43,7 +43,7 @@ final class MaximumLength implements PasswordValidatorInterface
|
||||
$password = $context->getPassword()->getString();
|
||||
|
||||
if (\strlen($password) > $maximumLength) {
|
||||
throw new ValidatorException(sprintf($this->translate('maxLength'), $maximumLength));
|
||||
throw new PasswordValidatorException(sprintf($this->translate('maxLength'), $maximumLength));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -14,7 +14,7 @@ declare(strict_types=1);
|
||||
namespace Terminal42\PasswordValidationBundle\Validation\Validator;
|
||||
|
||||
use Contao\System;
|
||||
use Symfony\Component\Validator\Exception\ValidatorException;
|
||||
use Terminal42\PasswordValidationBundle\Exception\PasswordValidatorException;
|
||||
use Terminal42\PasswordValidationBundle\Validation\PasswordValidatorInterface;
|
||||
use Terminal42\PasswordValidationBundle\Validation\ValidationConfiguration;
|
||||
use Terminal42\PasswordValidationBundle\Validation\ValidationContext;
|
||||
@@ -43,7 +43,7 @@ final class MinimumLength implements PasswordValidatorInterface
|
||||
$password = $context->getPassword()->getString();
|
||||
|
||||
if (\strlen($password) < $minimumLength) {
|
||||
throw new ValidatorException(sprintf($this->translate('minLength'), $minimumLength));
|
||||
throw new PasswordValidatorException(sprintf($this->translate('minLength'), $minimumLength));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace Terminal42\PasswordValidationBundle\Validation\Validator;
|
||||
use Contao\System;
|
||||
use Contao\User;
|
||||
use Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface;
|
||||
use Symfony\Component\Validator\Exception\ValidatorException;
|
||||
use Terminal42\PasswordValidationBundle\Exception\PasswordValidatorException;
|
||||
use Terminal42\PasswordValidationBundle\Model\PasswordHistory as PasswordHistoryModel;
|
||||
use Terminal42\PasswordValidationBundle\Validation\PasswordValidatorInterface;
|
||||
use Terminal42\PasswordValidationBundle\Validation\ValidationConfiguration;
|
||||
@@ -58,7 +58,7 @@ final class PasswordHistory implements PasswordValidatorInterface
|
||||
/** @var PasswordHistoryModel $log */
|
||||
foreach ($history as $log) {
|
||||
if ($this->verifyPassword((string) $log->password, $password)) {
|
||||
throw new ValidatorException($this->translate('passwordHistory'));
|
||||
throw new PasswordValidatorException($this->translate('passwordHistory'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace Terminal42\PasswordValidationBundle\Validation\Validator;
|
||||
|
||||
use Contao\StringUtil;
|
||||
use Contao\System;
|
||||
use Symfony\Component\Validator\Exception\ValidatorException;
|
||||
use Terminal42\PasswordValidationBundle\Exception\PasswordValidatorException;
|
||||
use Terminal42\PasswordValidationBundle\Validation\PasswordValidatorInterface;
|
||||
use Terminal42\PasswordValidationBundle\Validation\ValidationConfiguration;
|
||||
use Terminal42\PasswordValidationBundle\Validation\ValidationContext;
|
||||
@@ -56,18 +56,18 @@ final class RequiredCharacters implements PasswordValidatorInterface
|
||||
|
||||
if ($actual < $minimum) {
|
||||
if ('other' === $category) {
|
||||
$errors[] = new ValidatorException(
|
||||
$errors[] = new PasswordValidatorException(
|
||||
sprintf($this->translate('required.other'), $minimum, $configuration['other_chars'])
|
||||
);
|
||||
continue;
|
||||
}
|
||||
|
||||
$errors[] = new ValidatorException(sprintf($this->translate('required.'.$category), $minimum));
|
||||
$errors[] = new PasswordValidatorException(sprintf($this->translate('required.'.$category), $minimum));
|
||||
}
|
||||
}
|
||||
|
||||
if (\count($errors) > 1) {
|
||||
throw new ValidatorException(
|
||||
throw new PasswordValidatorException(
|
||||
sprintf(
|
||||
$this->translate('required.summary'),
|
||||
$require['uppercase'],
|
||||
|
||||
Reference in new issue
Block a user