summaryrefslogtreecommitdiff
path: root/app/Subscriber/AuthSubscriber.php
blob: 161a7afd9f3b2e45f3c3bdccdb8b035943e34f61 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?php

namespace Subscriber;

use Core\Request;
use Event\AuthEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;

class AuthSubscriber extends 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()
        );
    }
}