1 | <?php |
||
7 | class PasswordStrengthCheck implements \Mouf\Security\Password\Api\PasswordStrengthCheck |
||
8 | { |
||
9 | private $minimumLength = 7; |
||
10 | |||
11 | private $mustHaveUpperCase = true; |
||
12 | |||
13 | private $mustHaveLowerCase = true; |
||
14 | |||
15 | private $mustHaveNumber = true; |
||
16 | |||
17 | /** |
||
18 | * @var TranslatorInterface |
||
19 | */ |
||
20 | private $translationService; |
||
21 | |||
22 | /** |
||
23 | * PasswordStrengthCheck constructor. |
||
24 | * |
||
25 | * @param TranslatorInterface $translationService |
||
26 | */ |
||
27 | public function __construct(TranslatorInterface $translationService) |
||
31 | |||
32 | /** |
||
33 | * @return int |
||
34 | */ |
||
35 | public function getMinimumLength(): int |
||
39 | |||
40 | /** |
||
41 | * @param int|null $minimumLength |
||
42 | */ |
||
43 | public function setMinimumLength(int $minimumLength = null) |
||
47 | |||
48 | /** |
||
49 | * @return bool |
||
50 | */ |
||
51 | public function isMustHaveUpperCase(): bool |
||
55 | |||
56 | /** |
||
57 | * @param bool $mustHaveUpperCase |
||
58 | */ |
||
59 | public function setMustHaveUpperCase(bool $mustHaveUpperCase) |
||
63 | |||
64 | /** |
||
65 | * @return bool |
||
66 | */ |
||
67 | public function isMustHaveLowerCase(): bool |
||
71 | |||
72 | /** |
||
73 | * @param bool $mustHaveLowerCase |
||
74 | */ |
||
75 | public function setMustHaveLowerCase(bool $mustHaveLowerCase) |
||
79 | |||
80 | /** |
||
81 | * @return bool |
||
82 | */ |
||
83 | public function isMustHaveNumber(): bool |
||
87 | |||
88 | /** |
||
89 | * @param bool $mustHaveNumber |
||
90 | */ |
||
91 | public function setMustHaveNumber(bool $mustHaveNumber) |
||
95 | |||
96 | /** |
||
97 | * Returns true if the password is strong enough, false otherwise. |
||
98 | * |
||
99 | * @param string $password |
||
100 | * |
||
101 | * @return bool |
||
102 | */ |
||
103 | public function checkPasswordStrength(string $password) : bool |
||
123 | |||
124 | /** |
||
125 | * Returns a list of rules that password must fullfil (in text). |
||
126 | * |
||
127 | * @return string |
||
128 | */ |
||
129 | public function getPasswordRules() : string |
||
156 | } |
||
157 |