Add code for login monitoring

This commit is contained in:
James Cole 2024-10-10 06:17:48 +02:00
parent ec60194110
commit 562763c938
No known key found for this signature in database
GPG Key ID: B49A324B7EAD6D80

View File

@ -77,12 +77,16 @@ class LoginController extends Controller
*/
public function login(Request $request): JsonResponse|RedirectResponse
{
Log::channel('audit')->info(sprintf('User is trying to login using "%s"', $request->get($this->username())));
$username = $request->get($this->username());
Log::channel('audit')->info(sprintf('User is trying to login using "%s"', $username));
app('log')->debug('User is trying to login.');
try {
$this->validateLogin($request);
} catch (ValidationException $e) {
// basic validation exception.
// report the failed login to the user if the count is 2 or 5.
// TODO here be warning.
return redirect(route('login'))
->withErrors(
[