mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-14 01:13:37 -06:00
Error when blocked user logs in
This commit is contained in:
parent
b5c5f67fcc
commit
9c58b77f01
@ -82,6 +82,28 @@ class AuthController extends Controller
|
||||
$code = 'general_blocked';
|
||||
}
|
||||
$message = strval(trans('firefly.' . $code . '_error', ['email' => $credentials['email']]));
|
||||
|
||||
// send a message home about the blocked attempt to login.
|
||||
// perhaps in a later stage, simply log these messages.
|
||||
// send email.
|
||||
try {
|
||||
$email = env('SITE_OWNER', false);
|
||||
$fields = [
|
||||
'user_id' => $foundUser->id,
|
||||
'email' => $credentials['email'],
|
||||
'code' => $code,
|
||||
'message' => $message,
|
||||
'ip' => $request->ip(),
|
||||
];
|
||||
Mail::send(
|
||||
['emails.blocked-login-html', 'emails.blocked-login'], $fields, function (Message $message) use ($email) {
|
||||
$message->to($email, $email)->subject('Blocked a login attempt.');
|
||||
}
|
||||
);
|
||||
} catch (\Swift_TransportException $e) {
|
||||
Log::error($e->getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ($throttles) {
|
||||
|
27
resources/views/emails/blocked-login-html.twig
Normal file
27
resources/views/emails/blocked-login-html.twig
Normal file
@ -0,0 +1,27 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
|
||||
|
||||
</head>
|
||||
<body itemscope itemtype="http://schema.org/SoftwareApplication">
|
||||
|
||||
<p style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;">
|
||||
Hey there,
|
||||
</p>
|
||||
<p style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;">
|
||||
Firefly III has just blocked a login from user #{{ user_id }} ({{ email }}).
|
||||
</p>
|
||||
<p style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;">
|
||||
The blocked code was "{{ code }}" and the subsequent message was:
|
||||
</p>
|
||||
<p style="font-family: monospace;font-size:13px;">
|
||||
"{{ message }}"
|
||||
</p>
|
||||
|
||||
<p style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:11px;color:#aaa;">
|
||||
The login attempt came from IP {{ ip }}.
|
||||
</p>
|
||||
|
||||
</body>
|
||||
</html>
|
8
resources/views/emails/blocked-login.twig
Normal file
8
resources/views/emails/blocked-login.twig
Normal file
@ -0,0 +1,8 @@
|
||||
Hey there,
|
||||
|
||||
Firefly III has just blocked a login from user #{{ user_id }} ({{ email }}).
|
||||
|
||||
The blocked code was "{{ code }}" and the subsequent message was:
|
||||
"{{ message }}"
|
||||
|
||||
The login attempt came from IP {{ ip }}
|
Loading…
Reference in New Issue
Block a user