mirror of
				https://github.com/firefly-iii/firefly-iii.git
				synced 2025-10-31 18:54:58 +00:00 
			
		
		
		
	Removed deprecated event and handlers. (locked out user)
This commit is contained in:
		| @@ -1,42 +0,0 @@ | |||||||
| <?php |  | ||||||
| /** |  | ||||||
|  * LockedOutUser.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 LockedOutUser |  | ||||||
|  * |  | ||||||
|  * @deprecated |  | ||||||
|  * @package FireflyIII\Events |  | ||||||
|  */ |  | ||||||
| class LockedOutUser extends Event |  | ||||||
| { |  | ||||||
|     use SerializesModels; |  | ||||||
|  |  | ||||||
|     public $email; |  | ||||||
|     public $ipAddress; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * Create a new event instance. This event is triggered when a user gets themselves locked out. |  | ||||||
|      * |  | ||||||
|      * @param string $email |  | ||||||
|      * @param string $ipAddress |  | ||||||
|      */ |  | ||||||
|     public function __construct(string $email, string $ipAddress) |  | ||||||
|     { |  | ||||||
|         $this->email     = $email; |  | ||||||
|         $this->ipAddress = $ipAddress; |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| @@ -19,7 +19,6 @@ use FireflyIII\Events\BlockedUseOfDomain; | |||||||
| use FireflyIII\Events\BlockedUseOfEmail; | use FireflyIII\Events\BlockedUseOfEmail; | ||||||
| use FireflyIII\Events\ConfirmedUser; | use FireflyIII\Events\ConfirmedUser; | ||||||
| use FireflyIII\Events\DeletedUser; | use FireflyIII\Events\DeletedUser; | ||||||
| use FireflyIII\Events\LockedOutUser; |  | ||||||
| use FireflyIII\Events\RegisteredUser; | use FireflyIII\Events\RegisteredUser; | ||||||
| use FireflyIII\Events\RequestedNewPassword; | use FireflyIII\Events\RequestedNewPassword; | ||||||
| use FireflyIII\Events\ResentConfirmation; | use FireflyIII\Events\ResentConfirmation; | ||||||
| @@ -81,39 +80,6 @@ class UserEventHandler | |||||||
|         return true; |         return true; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * @param LockedOutUser $event |  | ||||||
|      * |  | ||||||
|      * @deprecated |  | ||||||
|      * @return bool |  | ||||||
|      */ |  | ||||||
|     public function reportLockout(LockedOutUser $event): bool |  | ||||||
|     { |  | ||||||
|         $email     = $event->email; |  | ||||||
|         $owner     = env('SITE_OWNER'); |  | ||||||
|         $ipAddress = $event->ipAddress; |  | ||||||
|         /** @var Configuration $sendmail */ |  | ||||||
|         $sendmail = FireflyConfig::get('mail_for_lockout', config('firefly.configuration.mail_for_lockout')); |  | ||||||
|         Log::debug(sprintf('Now in respondToLockout for email address %s', $email)); |  | ||||||
|         Log::error(sprintf('User %s was locked out after too many invalid login attempts.', $email)); |  | ||||||
|         if (is_null($sendmail) || (!is_null($sendmail) && $sendmail->data === false)) { |  | ||||||
|             return true; |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         // send email message: |  | ||||||
|         try { |  | ||||||
|             Mail::send( |  | ||||||
|                 ['emails.locked-out-html', 'emails.locked-out-text'], ['email' => $email, 'ip' => $ipAddress], function (Message $message) use ($owner) { |  | ||||||
|                 $message->to($owner, $owner)->subject('User was locked out'); |  | ||||||
|             } |  | ||||||
|             ); |  | ||||||
|         } catch (Swift_TransportException $e) { |  | ||||||
|             Log::error($e->getMessage()); |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         return true; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * @param BlockedUseOfDomain $event |      * @param BlockedUseOfDomain $event | ||||||
|      * |      * | ||||||
|   | |||||||
| @@ -14,7 +14,6 @@ namespace FireflyIII\Http\Controllers\Auth; | |||||||
|  |  | ||||||
| use Config; | use Config; | ||||||
| use FireflyConfig; | use FireflyConfig; | ||||||
| use FireflyIII\Events\LockedOutUser; |  | ||||||
| use FireflyIII\Http\Controllers\Controller; | use FireflyIII\Http\Controllers\Controller; | ||||||
| use FireflyIII\User; | use FireflyIII\User; | ||||||
| use Illuminate\Foundation\Auth\AuthenticatesUsers; | use Illuminate\Foundation\Auth\AuthenticatesUsers; | ||||||
| @@ -62,8 +61,6 @@ class LoginController extends Controller | |||||||
|         if ($lockedOut) { |         if ($lockedOut) { | ||||||
|             $this->fireLockoutEvent($request); |             $this->fireLockoutEvent($request); | ||||||
|  |  | ||||||
|             event(new LockedOutUser($request->get('email'), $request->ip())); |  | ||||||
|  |  | ||||||
|             return $this->sendLockoutResponse($request); |             return $this->sendLockoutResponse($request); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -46,10 +46,6 @@ class EventServiceProvider extends ServiceProvider | |||||||
|                 [ |                 [ | ||||||
|                     'FireflyIII\Handlers\Events\UserEventHandler@saveEmailAddress', |                     'FireflyIII\Handlers\Events\UserEventHandler@saveEmailAddress', | ||||||
|                 ], |                 ], | ||||||
|             'FireflyIII\Events\LockedOutUser'    => // is a User related event. |  | ||||||
|                 [ |  | ||||||
|                     'FireflyIII\Handlers\Events\UserEventHandler@reportLockout', |  | ||||||
|                 ], |  | ||||||
|  |  | ||||||
|             'FireflyIII\Events\BlockedUseOfEmail' => // is a User related event. |             'FireflyIII\Events\BlockedUseOfEmail' => // is a User related event. | ||||||
|                 [ |                 [ | ||||||
|   | |||||||
| @@ -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 locked out somebody trying to login with email address {{ email }}. |  | ||||||
| </p> |  | ||||||
| {% include 'emails.footer-html' %} |  | ||||||
| @@ -1,3 +0,0 @@ | |||||||
| {% include 'emails.header-text' %} |  | ||||||
| Firefly III has just locked out somebody trying to login with email address {{ email }}. |  | ||||||
| {% include 'emails.footer-text' %} |  | ||||||
		Reference in New Issue
	
	Block a user