Quantcast
Channel: Login only if user is active using Laravel - Stack Overflow
Viewing all articles
Browse latest Browse all 25

Answer by Rashi Goyal for Login only if user is active using Laravel

$
0
0
  protected function sendLoginResponse(Request $request) {  $request->session()->regenerate();  $this->clearLoginAttempts($request);  if ($response = $this->authenticated($request, $this->guard()->user())) {      return $response;  }  $user = $this->guard()->user();  if($user->is_active) {    return $request->wantsJson() ? new JsonResponse([], 204) : redirect()->intended($this->redirectPath());  } else {    $request->session()->flush();    return redirect()->route('login')->with('error', 'This account is not activated. Please contact the administrator.');  }    }

I put this function inside Auth\LoginController


Viewing all articles
Browse latest Browse all 25

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>