Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Removed deprecated event and handlers.
James Cole8ccdf9ea837d
diff --git a/app/Events/BlockedBadLogin.php b/app/Events/BlockedBadLogin.phpdeleted file mode 100644index f3e2ad3ad8..0000000000--- a/app/Events/BlockedBadLogin.php+++ /dev/null@@ -1,42 +0,0 @@-<?php-/**- * BlockedBadLogin.php- * Copyright (C) 2016 [email protected]- *- * 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;- }-}diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.phpindex 2d1a846044..1ee5cc1c74 100644--- a/app/Exceptions/Handler.php+++ b/app/Exceptions/Handler.php@@ -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);}diff --git a/app/Handlers/Events/UserEventHandler.php b/app/Handlers/Events/UserEventHandler.phpindex 316be2e682..774d23dc29 100644--- a/app/Handlers/Events/UserEventHandler.php+++ b/app/Handlers/Events/UserEventHandler.php@@ -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 UserEventHandlerreturn 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 booldiff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.phpindex 4eb2782162..a2944b98e4 100644--- a/app/Http/Controllers/Auth/LoginController.php+++ b/app/Http/Controllers/Auth/LoginController.php@@ -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 Controllerevent(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.diff --git a/app/Providers/EventServiceProvider.php b/app/Providers/EventServiceProvider.phpindex e9c971f2b2..f26e8266ac 100644--- a/app/Providers/EventServiceProvider.php+++ b/app/Providers/EventServiceProvider.php@@ -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',diff --git a/resources/views/emails/blocked-bad-creds-html.twig b/resources/views/emails/blocked-bad-creds-html.twigdeleted file mode 100644index 4485093a9b..0000000000--- a/resources/views/emails/blocked-bad-creds-html.twig+++ /dev/null@@ -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' %}diff --git a/resources/views/emails/blocked-bad-creds-text.twig b/resources/views/emails/blocked-bad-creds-text.twigdeleted file mode 100644index e0de014cff..0000000000--- a/resources/views/emails/blocked-bad-creds-text.twig+++ /dev/null@@ -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' %}