I'm trying to validate a password input field, and spaces are not getting caught by the validator. The password field should be a minimum of 6 characters, and the regex should allow spaces within a password, but not at the beginning or end (I've confirmed that this works outside of the validator).
When a user enters in 1+ spaces into the password field (but no other characters) and submits, the validator fails to catch it (i.e., " " isn't caught by the validator).
Here's what my validator looks like:
$this->validate($request, [
'name' => 'required|max:255|alpha',
'password' => 'http://regex:/^[^\s]+(\s+[^\s]+)*$/|min:6|confirmed',
]);
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire