Add extra validation rules to Laravel ForgotPassword

I wanted to add a captcha to the Forgot Password form, so I ended up doing this to the default ForgotPasswordController:

use Validator;
use \Illuminate\Http\Request;
 
class ForgotPasswordController extends Controller {
 
protected function validateEmail(Request $request)
{
    Validator::make(
        $request->all(),
        [
            'email' => 'required|email',
            'captcha' => 'required|captcha', // extra param to be validated
        ]
   )->validate();
}

Only relevant bits are shown there.

Leave a Reply

Your email address will not be published. Required fields are marked *