From 50bf64ca3fc0ea2a1c32edbd9c86840bf5fb6dde Mon Sep 17 00:00:00 2001 From: Muhammad Furqan Date: Mon, 10 Apr 2023 00:53:59 +0500 Subject: [PATCH] Prevent admin from login on user site --- app/Http/Requests/Auth/LoginRequest.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/Http/Requests/Auth/LoginRequest.php b/app/Http/Requests/Auth/LoginRequest.php index debaa90..4937c7c 100644 --- a/app/Http/Requests/Auth/LoginRequest.php +++ b/app/Http/Requests/Auth/LoginRequest.php @@ -46,7 +46,9 @@ public function authenticate() { $this->ensureIsNotRateLimited(); - if (!Auth::attempt($this->only('email', 'password'), $this->boolean('remember'))) { + $credentials = $this->only('email', 'password'); + $credentials['is_admin'] = 0; + if (!Auth::attempt($credentials, $this->boolean('remember'))) { RateLimiter::hit($this->throttleKey()); throw ValidationException::withMessages([