Laravel Auth: How to disable auto-login after registration?

Laravel default Auth system is great, but sometimes there's a need that user would register but NOT log in automatically. The problem is that Laravel does auto-login by default after registration. Worry no more, there is a simple solution for that! Let's start with fresh Laravel 5.2 installation and 'php artisan make:auth' command called. Of course this will work in existing projects too! Next, let's create a nice success page: (for the purpose of our tutorial I'm keeping it really simple)

    <div class="container">
        <div class="row">
            <div class="col-md-10 col-md-offset-1">
                <div class="alert alert-success">
                    Success! You have registered, please check your email for more instructions!
* File was saved under /resources/views/success.blade.php Now we add a route, in which user will be met with our success message:
Route::get('/auth/success', [
    'as'   => 'auth.success',
    'uses' => 'Auth\AuthController@success'
And finally - open app/Http/Controllers/Auth/AuthController.php and make these changes: 1. Add new method:
    public function success()
        return view('success');
2. Override 'register' method:
 * Handle a registration request for the application.
 * @param  \Illuminate\Http\Request $request
 * @return \Illuminate\Http\Response
public function register(Request $request)
    $validator = $this->validator($request->all());

    if ($validator->fails()) {
            $request, $validator


    return redirect(route('auth.success')); // Change this route to your needs
  That is it! By overriding AuthController::register() method and changing
in the code - you've disabled auto-login function. Now your users will see a nice success page instead of being logged in directly!

No comments or questions yet...

Like our articles?

Become a Premium Member for $129/year or $29/month
What else you will get:
  • 59 courses (1057 lessons, total 42 h 44 min)
  • 79 long-form tutorials (one new every week)
  • access to project repositories
  • access to private Discord

Recent Premium Tutorials