Closed ghost closed 7 years ago
app/Http/Controllers/Auth/RegisterController.php
it has the following action:
/**
* Get a validator for an incoming registration request.
*
* @param array $data
* @return \Illuminate\Contracts\Validation\Validator
*/
protected function validator(array $data)
{
return Validator::make($data, [
'name' => 'required|max:255',
'email' => 'required|email|max:255|unique:users',
'password' => 'required|min:6|confirmed',
]);
}
you may add :
/**
* Get a validator for an incoming registration request.
*
* @param array $data
* @return \Illuminate\Contracts\Validation\Validator
*/
protected function validator(array $data)
{
return Validator::make($data, [
'name' => 'required|max:255',
'email' => 'required|email|max:255|unique:users',
'password' => 'required|min:6|confirmed',
'g-recaptcha-response' => 'required|captcha'
]);
}
the view of register is located at: resources/views/auth/register.blade.php
add the snippet generator...
the LoginController uses the following trait:
<?php
use Illuminate\Foundation\Auth\AuthenticatesUsers;
and it has a function:
/**
* Validate the user login request.
*
* @param \Illuminate\Http\Request $request
* @return void
*/
protected function validateLogin(Request $request)
{
$this->validate($request, [
$this->username() => 'required', 'password' => 'required',
]);
}
Override this function inside the Controller and add the same validation of register, i hope it helps you :smiley_cat:
I solved it by removing all files under laravel-auth/storage/framework/sessions
Hello, How can I add reCAPTCHA to laravel Auth?(Default Auth)