This commit is contained in:
Bubka 2024-10-12 20:07:23 +02:00
parent c45fb2f658
commit 70cd730a49
5 changed files with 19 additions and 9 deletions

View File

@ -45,7 +45,9 @@ public function handle(mixed $event) : void
* @var \App\Models\User * @var \App\Models\User
*/ */
$user = $event->user; $user = $event->user;
$ip = $this->request->header(config('2fauth.proxy_headers.forIp'), $this->request->ip()); $ip = config('2fauth.proxy_headers.forIp')
? $this->request->header(config('2fauth.proxy_headers.forIp'), $this->request->ip())
: $this->request->ip();
$log = $user->authentications()->create([ $log = $user->authentications()->create([
'ip_address' => $ip, 'ip_address' => $ip,

View File

@ -43,8 +43,10 @@ public function handle(mixed $event) : void
/** /**
* @var \App\Models\User * @var \App\Models\User
*/ */
$user = $event->user; $user = $event->user;
$ip = $this->request->header(config('2fauth.proxy_headers.forIp'), $this->request->ip()); $ip = config('2fauth.proxy_headers.forIp')
? $this->request->header(config('2fauth.proxy_headers.forIp'), $this->request->ip())
: $this->request->ip();
$userAgent = $this->request->userAgent(); $userAgent = $this->request->userAgent();
$known = $user->authentications() $known = $user->authentications()
->whereIpAddress($ip) ->whereIpAddress($ip)

View File

@ -42,8 +42,10 @@ public function handle(mixed $event) : void
/** /**
* @var \App\Models\User * @var \App\Models\User
*/ */
$user = $event->user; $user = $event->user;
$ip = $this->request->header(config('2fauth.proxy_headers.forIp'), $this->request->ip()); $ip = config('2fauth.proxy_headers.forIp')
? $this->request->header(config('2fauth.proxy_headers.forIp'), $this->request->ip())
: $this->request->ip();
$userAgent = $this->request->userAgent(); $userAgent = $this->request->userAgent();
$log = $user->authentications() $log = $user->authentications()
->whereIpAddress($ip) ->whereIpAddress($ip)

View File

@ -48,8 +48,10 @@ public function handle(mixed $event) : void
/** /**
* @var \App\Models\User * @var \App\Models\User
*/ */
$user = $event->user; $user = $event->user;
$ip = $this->request->header(config('2fauth.proxy_headers.forIp'), $this->request->ip()); $ip = config('2fauth.proxy_headers.forIp')
? $this->request->header(config('2fauth.proxy_headers.forIp'), $this->request->ip())
: $this->request->ip();
$userAgent = $this->request->userAgent(); $userAgent = $this->request->userAgent();
$authLog = $user->authentications() $authLog = $user->authentications()
->whereIpAddress($ip) ->whereIpAddress($ip)

View File

@ -23,8 +23,10 @@ public function handle(mixed $event) : void
/** /**
* @var \App\Models\User * @var \App\Models\User
*/ */
$user = $event->user; $user = $event->user;
$ip = $this->request->header(config('2fauth.proxy_headers.forIp'), $this->request->ip()); $ip = config('2fauth.proxy_headers.forIp')
? $this->request->header(config('2fauth.proxy_headers.forIp'), $this->request->ip())
: $this->request->ip();
$userAgent = $this->request->userAgent(); $userAgent = $this->request->userAgent();
$guard = config('auth.defaults.guard'); $guard = config('auth.defaults.guard');
$known = $user->authentications() $known = $user->authentications()