Removed deprecated event and handlers. (block use of email and deleted user)

This commit is contained in:
James Cole
2016-12-28 10:07:36 +01:00
parent 2dbd9bd0b1
commit 94d0401f4e
8 changed files with 0 additions and 174 deletions

View File

@@ -15,9 +15,7 @@ namespace FireflyIII\Handlers\Events;
use Exception;
use FireflyConfig;
use FireflyIII\Events\BlockedUseOfEmail;
use FireflyIII\Events\ConfirmedUser;
use FireflyIII\Events\DeletedUser;
use FireflyIII\Events\RegisteredUser;
use FireflyIII\Events\RequestedNewPassword;
use FireflyIII\Events\ResentConfirmation;
@@ -79,70 +77,6 @@ class UserEventHandler
return true;
}
/**
* @param BlockedUseOfEmail $event
*
* @deprecated
* @return bool
*/
public function reportUseOfBlockedEmail(BlockedUseOfEmail $event): bool
{
$email = $event->email;
$owner = env('SITE_OWNER');
$ipAddress = $event->ipAddress;
/** @var Configuration $sendmail */
$sendmail = FireflyConfig::get('mail_for_blocked_email', config('firefly.configuration.mail_for_blocked_email'));
Log::debug(sprintf('Now in reportUseOfBlockedEmail for email address %s', $email));
Log::error(sprintf('Somebody tried to register using email address %s which is blocked (SHA2 hash).', $email));
if (is_null($sendmail) || (!is_null($sendmail) && $sendmail->data === false)) {
return true;
}
// send email message:
try {
Mail::send(
['emails.blocked-email-html', 'emails.blocked-email-text'],
[
'user_address' => $email,
'ip' => $ipAddress,
], function (Message $message) use ($owner) {
$message->to($owner, $owner)->subject('Blocked registration attempt with blocked email address');
}
);
} catch (Swift_TransportException $e) {
Log::error($e->getMessage());
}
return true;
}
/**
* @param DeletedUser $event
*
* @deprecated
* @return bool
*/
public function saveEmailAddress(DeletedUser $event): bool
{
Preferences::mark();
$email = hash('sha256', $event->email);
Log::debug(sprintf('Hash of email is %s', $email));
/** @var Configuration $configuration */
$configuration = FireflyConfig::get('deleted_users', []);
$content = $configuration->data;
if (!is_array($content)) {
$content = [];
}
$content[] = $email;
$configuration->data = $content;
Log::debug('New content of deleted_users is ', $content);
FireflyConfig::set('deleted_users', $content);
Preferences::mark();
return true;
}
/**
* This method will send a newly registered user a confirmation message, urging him or her to activate their account.
*