Laravel 13.x: Password-Regel als passwordrules-String ausgeben
Die neue Methode toPasswordRulesString() an der Password-Regel wandelt Validierungsvorgaben in das HTML-Attribut passwordrules um, damit Passwortmanager passende Passwörter erzeugen können.
Pull request by @imliam
Password managers like 1Password and Safari can read the passwordrules HTML attribute to generate passwords that satisfy your app's policy - no more rejected passwords and frustrated users at registration. The new toPasswordRulesString() method on the Password rule converts your validation constraints into the right format automatically.
<input
type="password"
autocomplete="new-password"
passwordrules="{{ Password::defaults()->toPasswordRulesString() }}"
/>
The method maps directly from your existing validation rules:
Password::min(12)->max(64)->mixedCase()->numbers()->symbols()->toPasswordRulesString()
// 'minlength: 12; maxlength: 64; required: lower; required: upper; required: digit; required: special;'