app/controllers/AuthController.php: fire onOAuthConnected event.
This commit is contained in:
parent
c270bfab0e
commit
4d073468ca
1 changed files with 9 additions and 0 deletions
|
|
@ -8,6 +8,13 @@ use App\Form\Login as LoginForm;
|
||||||
|
|
||||||
class AuthController extends ControllerBase
|
class AuthController extends ControllerBase
|
||||||
{
|
{
|
||||||
|
public function initialize()
|
||||||
|
{
|
||||||
|
// We need event manager here from DI.
|
||||||
|
$eventManager = $this->di->get('eventsManager');
|
||||||
|
$this->setEventsManager($eventManager);
|
||||||
|
}
|
||||||
|
|
||||||
public function indexAction()
|
public function indexAction()
|
||||||
{
|
{
|
||||||
$form = new LoginForm();
|
$form = new LoginForm();
|
||||||
|
|
@ -62,6 +69,8 @@ class AuthController extends ControllerBase
|
||||||
$user->{'set' . $name . 'Id'}($data->getId());
|
$user->{'set' . $name . 'Id'}($data->getId());
|
||||||
$user->save();
|
$user->save();
|
||||||
|
|
||||||
|
$this->getEventsManager()->fire('user:onOAuthConnected', $user, $data);
|
||||||
|
|
||||||
$this->flash->message('success', "<strong>{$name}</strong> was connected!");
|
$this->flash->message('success', "<strong>{$name}</strong> was connected!");
|
||||||
$this->response->redirect('/settings');
|
$this->response->redirect('/settings');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Reference in a new issue