octobercms/october · error · ValidationException
Password must have a minimum of length of :min characters
Error message
Password must have a minimum of length of :min characters
What it means
Validation failure in User::validatePasswordPolicy: the configured backend.password_policy min_length (default 4) exceeds the length of the supplied password. This is a policy guard applied during password set/reset, parameterized with the configured minimum.
Solutions
- Choose a password at least min_length characters long as stated in the message
- Adjust the min_length value in the backend.password_policy config if the policy is too strict for your users
- Surface the requirement in the front-end form so users know the minimum
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at modules/backend/models/User.php:357 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of octobercms/october@b608633a7e (2026-08-21).
Data as JSON: /api/errors/04c41008a45c6cfc.
Report an issue: GitHub.
Appendix: source
Thrown at modules/backend/models/User.php:357
return false;
}
$changedDays = (int) $this->freshTimestamp()
->diffInDays($this->password_changed_at ?: $this->created_at);
return $changedDays > $expireDays;
}
/**
* validatePasswordPolicy will check the password based on the backend policy
*/
public function validatePasswordPolicy($password)
{
$policy = Config::get('backend.password_policy', []);
if ($minLength = $policy['min_length'] ?? 4) {
if (mb_strlen($password) < $minLength) {
throw new ValidationException(['password' => __('Password must have a minimum of length of :min characters', ['min'=>$minLength])]);
}
}
if ($policy['require_uppercase'] ?? false) {
if (mb_strtolower($password) === $password) {
throw new ValidationException(['password' => __('Password must contain at least one uppercase character.')]);
}
}
if ($policy['require_lowercase'] ?? false) {
if (mb_strtoupper($password) === $password) {
throw new ValidationException(['password' => __('Password must contain at least one lowercase character.')]);
}
}
if ($policy['require_number'] ?? false) {
if (!array_filter(str_split($password), 'is_numeric')) {
throw new ValidationException(['password' => __('Password must contain at least one number.')]);View on GitHub (pinned to b608633a7e)