Skip to content

Conversation

jochensengier
Copy link
Contributor

A Form Request or Validator with a custom attribute and/or message for a password field are discarded in the Validator of the Password Rule and defaults are returned.

Example Form Request:

...

public function rules()
{
    return [
        'password' => [
            Password::min(8),
        ],
    ];
}

public function attributes()
{
    return [
        'password' => 'alternative attribute',
    ];
}

public function messages()
{
    return [
        'password.min' => 'Demo for Pull Request :attribute',
    ];
}

...

It should return 'Demo for Pull Request: alternative attribute' however, 'The password must be at least 8 characters.' is returned.

Unless I'm mistaken, this should be an easy fix without any breaking changes.

Looking forward to any feedback and suggestions regarding this pull request.

Thanks!

@jochensengier jochensengier changed the title Password Validator should inherit custom error message and attribute [8.x] Password Validator should inherit custom error message and attribute Jul 23, 2021
@taylorotwell taylorotwell merged commit a4081b3 into laravel:8.x Jul 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants