diff options
Diffstat (limited to 'app/Subscriber/AuthSubscriber.php')
-rw-r--r-- | app/Subscriber/AuthSubscriber.php | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/app/Subscriber/AuthSubscriber.php b/app/Subscriber/AuthSubscriber.php new file mode 100644 index 00000000..b814057f --- /dev/null +++ b/app/Subscriber/AuthSubscriber.php @@ -0,0 +1,27 @@ +<?php + +namespace Subscriber; + +use Core\Request; +use Event\AuthEvent; +use Symfony\Component\EventDispatcher\EventSubscriberInterface; + +class AuthSubscriber extends \Core\Base implements EventSubscriberInterface +{ + public static function getSubscribedEvents() + { + return array( + 'auth.success' => array('onSuccess', 0), + ); + } + + public function onSuccess(AuthEvent $event) + { + $this->lastLogin->create( + $event->getAuthType(), + $event->getUserId(), + Request::getIpAddress(), + Request::getUserAgent() + ); + } +} |