-
Notifications
You must be signed in to change notification settings - Fork 11k
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
[5.3] Allow overriding of ResetsPasswords validation rules. #15086
Comments
You can simply override this function in your controller, and set it accordingly. I have myself done it to be inline with how it was in 5.2. |
Thank you. I had mentioned that as a solution too but was trying avoid having the response logic in my controller in case it changed in the framework in the future. Seems like we shouldn't really be overriding the lines below. But then again, testing after framework updates would soon flag if there had been any changes :) Thanks for taking a look.
|
I was just about the raise the same issue as I was trying to customise the validation rules for minimum password length and I agree with @danielbaylis that it would be better to not have to copy and paste the response logic into the override. I think this decision should be reconsidered, the RegisterController provides a validator that can be customised so it seems a bit inconsistent to have to do something different for the password resets. |
@roberthunt - I understand PRs have a better chance than issues, so am giving it a go with #16060. |
PR #16060 was merged and resolves this. :) |
Hardcoding the validation rules directly in the ResetsPasswords reset method prevents us overriding the rules in ResetsPasswordController without overriding the entire function.
Illuminate\Foundation\Auth\ResetsPasswords
$this->validate($request, [ 'token' => 'required', 'email' => 'required|email', 'password' => 'required|confirmed|min:6', ]);
It would be nice to revert to the 5.2 approach where there was a separate method of the validation rules that we could simply override in the controller:
$this->validate($request, $this->getResetValidationRules());
This allows domain-specific validations to be used without bringing the other framework logic into the controller.
The text was updated successfully, but these errors were encountered: