mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Removed deprecated event and handlers.
This commit is contained in:
parent
9c6a3e4ad5
commit
8ccdf9ea83
@ -1,42 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* BlockedBadLogin.php
|
||||
* Copyright (C) 2016 thegrumpydictator@gmail.com
|
||||
*
|
||||
* This software may be modified and distributed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International License.
|
||||
*
|
||||
* See the LICENSE file for details.
|
||||
*/
|
||||
|
||||
declare(strict_types = 1);
|
||||
|
||||
namespace FireflyIII\Events;
|
||||
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
/**
|
||||
* Class BlockedBadLogin
|
||||
*
|
||||
* @deprecated
|
||||
* @package FireflyIII\Events
|
||||
*/
|
||||
class BlockedBadLogin extends Event
|
||||
{
|
||||
use SerializesModels;
|
||||
|
||||
public $email;
|
||||
public $ipAddress;
|
||||
|
||||
/**
|
||||
* Create a new event instance. This event is triggered when a bad login is blocked.
|
||||
*
|
||||
* @param string $email
|
||||
* @param string $ipAddress
|
||||
*/
|
||||
public function __construct(string $email, string $ipAddress)
|
||||
{
|
||||
$this->email = $email;
|
||||
$this->ipAddress = $ipAddress;
|
||||
}
|
||||
}
|
@ -19,6 +19,7 @@ use Illuminate\Auth\Access\AuthorizationException;
|
||||
use Illuminate\Auth\AuthenticationException;
|
||||
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
||||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
||||
use Request;
|
||||
use Illuminate\Session\TokenMismatchException;
|
||||
use Illuminate\Validation\ValidationException as ValException;
|
||||
use Symfony\Component\HttpKernel\Exception\HttpException;
|
||||
@ -99,7 +100,7 @@ class Handler extends ExceptionHandler
|
||||
];
|
||||
|
||||
// create job that will mail.
|
||||
$ipAddress = $_SERVER['REMOTE_ADDR'] ?? '0.0.0.0';
|
||||
$ipAddress = Request::ip() ?? '0.0.0.0';
|
||||
$job = new MailError($userData, env('SITE_OWNER', ''), $ipAddress, $data);
|
||||
dispatch($job);
|
||||
}
|
||||
|
@ -15,7 +15,6 @@ namespace FireflyIII\Handlers\Events;
|
||||
|
||||
use Exception;
|
||||
use FireflyConfig;
|
||||
use FireflyIII\Events\BlockedBadLogin;
|
||||
use FireflyIII\Events\BlockedUseOfDomain;
|
||||
use FireflyIII\Events\BlockedUseOfEmail;
|
||||
use FireflyIII\Events\BlockedUserLogin;
|
||||
@ -42,6 +41,7 @@ use Swift_TransportException;
|
||||
*
|
||||
* The method name reflects what is being done. This is in the present tense.
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.TooManyPublicMethods) // some of these methods will disappear soon.
|
||||
*
|
||||
* @package FireflyIII\Handlers\Events
|
||||
*/
|
||||
@ -82,40 +82,6 @@ class UserEventHandler
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param BlockedBadLogin $event
|
||||
*
|
||||
* @deprecated
|
||||
* @return bool
|
||||
*/
|
||||
public function reportBadLogin(BlockedBadLogin $event)
|
||||
{
|
||||
$email = $event->email;
|
||||
$owner = env('SITE_OWNER');
|
||||
$ipAddress = $event->ipAddress;
|
||||
/** @var Configuration $sendmail */
|
||||
$sendmail = FireflyConfig::get('mail_for_bad_login', config('firefly.configuration.mail_for_bad_login'));
|
||||
Log::debug(sprintf('Now in reportBadLogin for email address %s', $email));
|
||||
Log::error(sprintf('User %s tried to login with bad credentials.', $email));
|
||||
if (is_null($sendmail) || (!is_null($sendmail) && $sendmail->data === false)) {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
try {
|
||||
Mail::send(
|
||||
['emails.blocked-bad-creds-html', 'emails.blocked-bad-creds-text'], ['email' => $email, 'ip' => $ipAddress],
|
||||
function (Message $message) use ($owner) {
|
||||
$message->to($owner, $owner)->subject('Blocked login attempt with bad credentials');
|
||||
}
|
||||
);
|
||||
} catch (Swift_TransportException $e) {
|
||||
Log::error($e->getMessage());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param BlockedUserLogin $event
|
||||
*
|
||||
@ -385,6 +351,7 @@ class UserEventHandler
|
||||
* from the user yet stored conveniently.
|
||||
*
|
||||
* @param ConfirmedUser $event
|
||||
*
|
||||
* @deprecated
|
||||
*
|
||||
* @return bool
|
||||
@ -401,6 +368,7 @@ class UserEventHandler
|
||||
* fashion as the previous method.
|
||||
*
|
||||
* @param RegisteredUser $event
|
||||
*
|
||||
* @deprecated
|
||||
*
|
||||
* @return bool
|
||||
|
@ -14,7 +14,6 @@ namespace FireflyIII\Http\Controllers\Auth;
|
||||
|
||||
use Config;
|
||||
use FireflyConfig;
|
||||
use FireflyIII\Events\BlockedBadLogin;
|
||||
use FireflyIII\Events\BlockedUserLogin;
|
||||
use FireflyIII\Events\LockedOutUser;
|
||||
use FireflyIII\Http\Controllers\Controller;
|
||||
@ -87,11 +86,6 @@ class LoginController extends Controller
|
||||
event(new BlockedUserLogin($foundUser, $request->ip()));
|
||||
}
|
||||
|
||||
// simply a bad login.
|
||||
if (is_null($foundUser)) {
|
||||
event(new BlockedBadLogin($credentials['email'], $request->ip()));
|
||||
}
|
||||
|
||||
// If the login attempt was unsuccessful we will increment the number of attempts
|
||||
// to login and redirect the user back to the login form. Of course, when this
|
||||
// user surpasses their maximum number of attempts they will get locked out.
|
||||
|
@ -64,11 +64,6 @@ class EventServiceProvider extends ServiceProvider
|
||||
[
|
||||
'FireflyIII\Handlers\Events\UserEventHandler@reportUseBlockedDomain',
|
||||
],
|
||||
|
||||
'FireflyIII\Events\BlockedBadLogin' => // is a User related event.
|
||||
[
|
||||
'FireflyIII\Handlers\Events\UserEventHandler@reportBadLogin',
|
||||
],
|
||||
'FireflyIII\Events\RegisteredUser' => // is a User related event.
|
||||
[
|
||||
'FireflyIII\Handlers\Events\UserEventHandler@sendRegistrationMail',
|
||||
|
@ -1,5 +0,0 @@
|
||||
{% include 'emails.header-html' %}
|
||||
<p style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;">
|
||||
Firefly III has just blocked a login from user with email "{{ email }}" because they supplied bad credentials.
|
||||
</p>
|
||||
{% include 'emails.footer-html' %}
|
@ -1,3 +0,0 @@
|
||||
{% include 'emails.header-text' %}
|
||||
Firefly III has just blocked a login from user with email "{{ email }}" because they supplied bad credentials.
|
||||
{% include 'emails.footer-text' %}
|
Loading…
Reference in New Issue
Block a user