title: Laravel fortify, prevent user login if user not active
body: <p>I have a problem with authentication users, in table users I have column <code>active</code>. I need prevent user authentication if <code>active = 0</code> and show on login page message: <code>Sorry. Your account is disabled.</code>. How I can do it? I tried use:</p>
  <pre><code>/**
     * Bootstrap any application services.
     *
     * @return void
     */
  public function boot()
  {
     // ...
  
  Fortify::authenticateUsing(function (Request $request) {
      $user = User::where('email', $request-&gt;email)-&gt;first();
  
      if(!$user-&gt;active) {
          redirect()-&gt;back()-&gt;with('message', 'Your account is disabled!');
      }
  
      if ($user &amp;&amp;
          Hash::check($request-&gt;password, $user-&gt;password)) {
          return $user;
      }
    });
  }
  </code></pre>
  <p>This working, but not working when user is being registered. After registration, he login without my verification on <code>active = 0</code></p>
  <p>I tried and middleware CheckActiveUser:</p>
  <pre><code>  /**
   * Handle an incoming request.
   *
   * @param  \Illuminate\Http\Request  $request
   * @param  \Closure  $next
   * @return mixed
   */
  public function handle(Request $request, Closure $next)
  {
      if(!$request-&gt;user()-&gt;active) {
          return redirect()-&gt;route('login')-&gt;with(['status' =&gt; 'Your account is not activated!']);
      }
  
      return $next($request);
  }
  </code></pre>
  <p>But I ger error <code>site.com redirected you too many times.</code></p>
  <p>Routes:</p>
  <pre><code>Route::group(['middleware' =&gt; ['auth:sanctum', 'verified', 'checkActiveUser']], function() {
  Route::get('/anamnesis', 'App\\Http\\Controllers\\AnamnesisController@index')-&gt;name('anamnesis');
  Route::view('/console', 'console')-&gt;name('home');
  Route::view('/history', 'history')-&gt;name('history');
  Route::view('/calendar', 'calendar')-&gt;name('calendar');
  Route::get('/results', 'App\\Http\\Controllers\\ResultsController@index')-&gt;name('results');
  Route::delete('/results/{document}', 'App\\Http\\Controllers\\ResultsController@delete')-&gt;name('documents.delete');
  Route::view('/conversations', 'conversations')-&gt;name('conversations');
  Route::view('/order-payment', 'orderpayment')-&gt;name('order-payment');
  });
  </code></pre>