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

Answer by Suraj Datheputhe for Login only if user is active using Laravel

$
0
0

Simply you can put these code in your Auth\LoginController.php file. It overrides the authenticated class of Laravel.

The user has been authenticated and check user is active or not, if user is not active it will be logged out and redirect login page with error.

protected function authenticated(Request $request, $user){    if ($user->isActive() === false) {        auth()->logout();        return redirect()            ->back()            ->withInput()            ->withErrors(['email' => __('Inactive account.')]);    } else {        // you are authenticated    }}

Viewing all articles
Browse latest Browse all 25

Trending Articles



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