2020-09-08 00:31:09 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Listeners;
|
|
|
|
|
2020-10-21 00:29:50 +00:00
|
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
|
|
use Illuminate\Queue\InteractsWithQueue;
|
2020-09-08 00:31:09 +00:00
|
|
|
use Illuminate\Support\Facades\Log;
|
|
|
|
|
|
|
|
class LogAuthenticationSuccess
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Create the event listener.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
//
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Handle the event.
|
|
|
|
*
|
|
|
|
* @param object $event
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function handle($event)
|
|
|
|
{
|
|
|
|
Log::info('SECURITY (postauth-pre2fa): Detected successful login attempt', [
|
|
|
|
'accountID' => $event->user->id,
|
|
|
|
'sourceIP' => request()->ip(),
|
|
|
|
'matchesAccountLastIP' => request()->ip() == $event->user->originalIP,
|
|
|
|
'sourceUserAgent' => request()->userAgent(),
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
}
|