Skip to content
2 changes: 1 addition & 1 deletion docs/guides/strengthen_password.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`,
Expand Down
5 changes: 5 additions & 0 deletions src/Authentication/Passwords/ValidationRules.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand All @@ -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
{
Expand Down
2 changes: 1 addition & 1 deletion src/Controllers/RegisterController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
],
Expand Down