I'm using Laravel 5.3 and the php artisan command make:auth to scaffold the registration and login. After a user registers, I want to redirect him to a page that says something like "Verify your email" and I don't want it to automatically login the user like default.
I can only think of, in the create() method in the RegisterController, instead of returning the User(I assume that's where it automatically logins), I want to redirect to another view.
protected function create(array $data)
{
$confirmation_code = str_random(30);
Mail::to($data['email'])->send(new Company($confirmation_code));
User::create([
'confirmation_code' => $confirmation_code,
'password' => bcrypt($data['password']),
'email' => $data['email']
]);
return redirect()->route('verifyemail');
}
But I get this error: Argument 1 passed to Illuminate\Auth\SessionGuard::login() must implement interface Illuminate\Contracts\Auth\Authenticatable, instance of Illuminate\Http\RedirectResponse given, called in C:\xampp\htdocs\app\vendor\laravel\framework\src\Illuminate\Foundation\Auth\RegistersUsers.php on line 32 and defined
I tried to override the register(Request $request) method in the RegistersUsers.php to take out the line that makes the logins, but it's still not working.
Any ideas?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire