mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Removed deprecated event and handlers. (block use of domain)
This commit is contained in:
parent
9168c97eb6
commit
2dbd9bd0b1
@ -1,44 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* BlockedUseOfDomain.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 BlockedUseOfDomain
|
||||
*
|
||||
* @deprecated
|
||||
* @package FireflyIII\Events
|
||||
*/
|
||||
class BlockedUseOfDomain extends Event
|
||||
{
|
||||
use SerializesModels;
|
||||
|
||||
public $email;
|
||||
public $ipAddress;
|
||||
|
||||
/**
|
||||
* Create a new event instance. This event is triggered when a user tries to register with a banned domain (on blocked domain list).
|
||||
*
|
||||
* @deprecated
|
||||
* @param string $email
|
||||
* @param string $ipAddress
|
||||
*/
|
||||
public function __construct(string $email, string $ipAddress)
|
||||
{
|
||||
$this->email = $email;
|
||||
$this->ipAddress = $ipAddress;
|
||||
}
|
||||
}
|
@ -15,7 +15,6 @@ namespace FireflyIII\Handlers\Events;
|
||||
|
||||
use Exception;
|
||||
use FireflyConfig;
|
||||
use FireflyIII\Events\BlockedUseOfDomain;
|
||||
use FireflyIII\Events\BlockedUseOfEmail;
|
||||
use FireflyIII\Events\ConfirmedUser;
|
||||
use FireflyIII\Events\DeletedUser;
|
||||
@ -80,45 +79,6 @@ class UserEventHandler
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param BlockedUseOfDomain $event
|
||||
*
|
||||
* @deprecated
|
||||
* @return bool
|
||||
*/
|
||||
public function reportUseBlockedDomain(BlockedUseOfDomain $event): bool
|
||||
{
|
||||
$email = $event->email;
|
||||
$owner = env('SITE_OWNER');
|
||||
$ipAddress = $event->ipAddress;
|
||||
$parts = explode('@', $email);
|
||||
/** @var Configuration $sendmail */
|
||||
$sendmail = FireflyConfig::get('mail_for_blocked_domain', config('firefly.configuration.mail_for_blocked_domain'));
|
||||
Log::debug(sprintf('Now in reportUseBlockedDomain for email address %s', $email));
|
||||
Log::error(sprintf('Somebody tried to register using an email address (%s) connected to a banned domain (%s).', $email, $parts[1]));
|
||||
if (is_null($sendmail) || (!is_null($sendmail) && $sendmail->data === false)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// send email message:
|
||||
try {
|
||||
Mail::send(
|
||||
['emails.blocked-registration-html', 'emails.blocked-registration-text'],
|
||||
[
|
||||
'email_address' => $email,
|
||||
'blocked_domain' => $parts[1],
|
||||
'ip' => $ipAddress,
|
||||
], function (Message $message) use ($owner) {
|
||||
$message->to($owner, $owner)->subject('Blocked registration attempt with blocked domain');
|
||||
}
|
||||
);
|
||||
} catch (Swift_TransportException $e) {
|
||||
Log::error($e->getMessage());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param BlockedUseOfEmail $event
|
||||
*
|
||||
|
@ -15,7 +15,6 @@ namespace FireflyIII\Http\Controllers\Auth;
|
||||
use Auth;
|
||||
use Config;
|
||||
use FireflyConfig;
|
||||
use FireflyIII\Events\BlockedUseOfDomain;
|
||||
use FireflyIII\Events\BlockedUseOfEmail;
|
||||
use FireflyIII\Events\RegisteredUser;
|
||||
use FireflyIII\Http\Controllers\Controller;
|
||||
@ -81,8 +80,6 @@ class RegisterController extends Controller
|
||||
// is user email domain blocked?
|
||||
if ($this->isBlockedDomain($data['email'])) {
|
||||
$validator->getMessageBag()->add('email', (string)trans('validation.invalid_domain'));
|
||||
|
||||
event(new BlockedUseOfDomain($data['email'], $request->ip()));
|
||||
$this->throwValidationException($request, $validator);
|
||||
}
|
||||
|
||||
|
@ -51,11 +51,6 @@ class EventServiceProvider extends ServiceProvider
|
||||
[
|
||||
'FireflyIII\Handlers\Events\UserEventHandler@reportUseOfBlockedEmail',
|
||||
],
|
||||
|
||||
'FireflyIII\Events\BlockedUseOfDomain' => // is a User related event.
|
||||
[
|
||||
'FireflyIII\Handlers\Events\UserEventHandler@reportUseBlockedDomain',
|
||||
],
|
||||
'FireflyIII\Events\RegisteredUser' => // is a User related event.
|
||||
[
|
||||
'FireflyIII\Handlers\Events\UserEventHandler@sendRegistrationMail',
|
||||
|
@ -1,8 +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 registration for an email addres at domain {{ blocked_domain }}.
|
||||
</p>
|
||||
<p style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;">
|
||||
The blocked email address was "{{ email_address }}".
|
||||
</p>
|
||||
{% include 'emails.footer-html' %}
|
@ -1,5 +0,0 @@
|
||||
{% include 'emails.header-text' %}
|
||||
Firefly III has just blocked a registration for an email addres at domain {{ blocked_domain }}.
|
||||
|
||||
The blocked email address was "{{ email_address }}".
|
||||
{% include 'emails.footer-text' %}
|
Loading…
Reference in New Issue
Block a user