diff --git a/docs/guides/strengthen_password.md b/docs/guides/strengthen_password.md index 5d9345022..102dc9b1d 100644 --- a/docs/guides/strengthen_password.md +++ b/docs/guides/strengthen_password.md @@ -17,7 +17,7 @@ The longer the password, the stronger it is. Consider increasing the value. > **Note** > -> This checking works when you validate passwords with the `strong_password` +> This checking works when you validate passwords with the `strong_password[]` > validation rule. > > If you disable `CompositionValidator` (enabled by default) in `$passwordValidators`, diff --git a/src/Authentication/Passwords/ValidationRules.php b/src/Authentication/Passwords/ValidationRules.php index 36fc0477d..c240ec016 100644 --- a/src/Authentication/Passwords/ValidationRules.php +++ b/src/Authentication/Passwords/ValidationRules.php @@ -40,6 +40,7 @@ public function strong_password(string $value, ?string &$error1 = null, array $d if (function_exists('auth') && auth()->user()) { $user = auth()->user(); } else { + /** @phpstan-ignore-next-line */ $user = empty($data) ? $this->buildUserFromRequest() : $this->buildUserFromData($data); } @@ -66,6 +67,10 @@ public function max_byte(?string $str, string $val): bool /** * Builds a new user instance from the global request. + * + * @deprecated This will be removed soon. + * + * @see https://github.com/codeigniter4/shield/pull/747#discussion_r1198778666 */ protected function buildUserFromRequest(): User { diff --git a/src/Controllers/RegisterController.php b/src/Controllers/RegisterController.php index e48509585..e0e2a8045 100644 --- a/src/Controllers/RegisterController.php +++ b/src/Controllers/RegisterController.php @@ -197,7 +197,7 @@ protected function getValidationRules(): array ], 'password' => [ 'label' => 'Auth.password', - 'rules' => 'required|' . Passwords::getMaxLengthRule() . '|strong_password', + 'rules' => 'required|' . Passwords::getMaxLengthRule() . '|strong_password[]', 'errors' => [ 'max_byte' => 'Auth.errorPasswordTooLongBytes', ],