mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 21:22:58 +01:00
New login notification
This commit is contained in:
parent
f60b9c30eb
commit
ac77100981
@ -18,11 +18,14 @@ use App\Http\Controllers\BaseController;
|
|||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Jobs\Account\CreateAccount;
|
use App\Jobs\Account\CreateAccount;
|
||||||
use App\Jobs\Company\CreateCompanyToken;
|
use App\Jobs\Company\CreateCompanyToken;
|
||||||
|
use App\Jobs\Util\SystemLogger;
|
||||||
use App\Libraries\MultiDB;
|
use App\Libraries\MultiDB;
|
||||||
use App\Libraries\OAuth\OAuth;
|
use App\Libraries\OAuth\OAuth;
|
||||||
use App\Libraries\OAuth\Providers\Google;
|
use App\Libraries\OAuth\Providers\Google;
|
||||||
|
use App\Models\Client;
|
||||||
use App\Models\CompanyToken;
|
use App\Models\CompanyToken;
|
||||||
use App\Models\CompanyUser;
|
use App\Models\CompanyUser;
|
||||||
|
use App\Models\SystemLog;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use App\Transformers\CompanyUserTransformer;
|
use App\Transformers\CompanyUserTransformer;
|
||||||
use App\Utils\Ninja;
|
use App\Utils\Ninja;
|
||||||
@ -232,6 +235,14 @@ class LoginController extends BaseController
|
|||||||
->increment()
|
->increment()
|
||||||
->batch();
|
->batch();
|
||||||
|
|
||||||
|
SystemLogger::dispatch(
|
||||||
|
request()->getClientIp(),
|
||||||
|
SystemLog::CATEGORY_SECURITY,
|
||||||
|
SystemLog::EVENT_USER,
|
||||||
|
SystemLog::TYPE_LOGIN_FAILURE,
|
||||||
|
Client::first(),
|
||||||
|
);
|
||||||
|
|
||||||
$this->incrementLoginAttempts($request);
|
$this->incrementLoginAttempts($request);
|
||||||
|
|
||||||
return response()
|
return response()
|
||||||
|
@ -13,8 +13,11 @@ namespace App\Listeners\User;
|
|||||||
|
|
||||||
use App\Jobs\Mail\NinjaMailerJob;
|
use App\Jobs\Mail\NinjaMailerJob;
|
||||||
use App\Jobs\Mail\NinjaMailerObject;
|
use App\Jobs\Mail\NinjaMailerObject;
|
||||||
|
use App\Jobs\Util\SystemLogger;
|
||||||
use App\Libraries\MultiDB;
|
use App\Libraries\MultiDB;
|
||||||
use App\Mail\User\UserLoggedIn;
|
use App\Mail\User\UserLoggedIn;
|
||||||
|
use App\Models\Client;
|
||||||
|
use App\Models\SystemLog;
|
||||||
use Illuminate\Broadcasting\InteractsWithSockets;
|
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
use Illuminate\Foundation\Events\Dispatchable;
|
use Illuminate\Foundation\Events\Dispatchable;
|
||||||
@ -64,6 +67,13 @@ class UpdateUserLastLogin implements ShouldQueue
|
|||||||
$user->save();
|
$user->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SystemLogger::dispatch(
|
||||||
|
$ip,
|
||||||
|
SystemLog::CATEGORY_SECURITY,
|
||||||
|
SystemLog::EVENT_USER,
|
||||||
|
SystemLog::TYPE_LOGIN_SUCCESS,
|
||||||
|
$event->company->clients()->first(),
|
||||||
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -78,6 +78,9 @@ class SystemLog extends Model
|
|||||||
const TYPE_MODIFIED = 701;
|
const TYPE_MODIFIED = 701;
|
||||||
const TYPE_DELETED = 702;
|
const TYPE_DELETED = 702;
|
||||||
|
|
||||||
|
const TYPE_LOGIN_SUCCESS = 800;
|
||||||
|
const TYPE_LOGIN_FAILURE = 801;
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'client_id',
|
'client_id',
|
||||||
'company_id',
|
'company_id',
|
||||||
|
Loading…
Reference in New Issue
Block a user