firefly-iii/app/Handlers/Events/UserSaveIpAddress.php

64 lines
1.3 KiB
PHP
Raw Normal View History

<?php
/**
* UserSaveIpAddress.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\Handlers\Events;
use FireflyIII\Events\UserIsConfirmed;
use FireflyIII\Events\UserRegistration;
use Preferences;
/**
* Class UserSaveIpAddress
*
* @package FireflyIII\Handlers\Events
*/
class UserSaveIpAddress
{
/**
* Create the event listener.
*
*/
public function __construct()
{
//
}
/**
* Handle the event.
*
2016-08-26 01:21:31 -05:00
* @param UserIsConfirmed $event
*
* @return bool
*/
2016-08-26 01:21:31 -05:00
public function saveFromConfirmation(UserIsConfirmed $event): bool
{
2016-08-26 01:21:31 -05:00
Preferences::setForUser($event->user, 'confirmation_ip_address', $event->ipAddress);
return true;
}
/**
* Handle the event.
*
2016-08-26 01:21:31 -05:00
* @param UserRegistration $event
*
* @return bool
*/
2016-08-26 01:21:31 -05:00
public function saveFromRegistration(UserRegistration $event): bool
{
2016-08-26 01:21:31 -05:00
Preferences::setForUser($event->user, 'registration_ip_address', $event->ipAddress);
return true;
}
2016-08-12 08:10:03 -05:00
}