diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2019-08-27 14:17:29 +0300 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2019-08-27 16:02:33 +0300 |
commit | 7d92b2c80dbb5d095997c9c674d67d6cb05cf435 (patch) | |
tree | 97fb8236a10f9cd7a355824c7f8fb10759c63938 /lib | |
parent | ff72ceaecb8765645422bc59c7939ae885f9dc1d (diff) |
Better readability
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Validator/CommonPasswordsValidator.php | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/lib/Validator/CommonPasswordsValidator.php b/lib/Validator/CommonPasswordsValidator.php index 0910f40..f0942bd 100644 --- a/lib/Validator/CommonPasswordsValidator.php +++ b/lib/Validator/CommonPasswordsValidator.php @@ -42,17 +42,15 @@ class CommonPasswordsValidator implements IValidator { public function validate(string $password): void { $enforceNonCommonPassword = $this->config->getEnforceNonCommonPassword(); - if($enforceNonCommonPassword) { - $passwordFile = __DIR__ . '/../../lists/list-'.strlen($password).'.php'; - if(file_exists($passwordFile)) { - $commonPasswords = require_once $passwordFile; - if (isset($commonPasswords[strtolower($password)])) { - $message = 'Password is among the 1,000,000 most common ones. Please make it unique.'; - $message_t = $this->l->t( - 'Password is among the 1,000,000 most common ones. Please make it unique.' - ); - throw new HintException($message, $message_t); - } + $passwordFile = __DIR__ . '/../../lists/list-'.strlen($password).'.php'; + if($enforceNonCommonPassword && file_exists($passwordFile)) { + $commonPasswords = require_once $passwordFile; + if (isset($commonPasswords[strtolower($password)])) { + $message = 'Password is among the 1,000,000 most common ones. Please make it unique.'; + $message_t = $this->l->t( + 'Password is among the 1,000,000 most common ones. Please make it unique.' + ); + throw new HintException($message, $message_t); } } } |