Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[8.x] Password Validator should inherit custom error message and attribute #38114

Merged
merged 1 commit into from
Jul 23, 2021
Merged

[8.x] Password Validator should inherit custom error message and attribute #38114

merged 1 commit into from
Jul 23, 2021

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