From aab77e9608a7fc50822a4fcf0084997320d182a2 Mon Sep 17 00:00:00 2001 From: Henrik Hautakoski Date: Sun, 1 Apr 2018 18:28:19 +0200 Subject: [PATCH] app/library/Auth.php: fire events when users log in. --- app/library/Auth.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/library/Auth.php b/app/library/Auth.php index ac77a2c..0aa51b5 100644 --- a/app/library/Auth.php +++ b/app/library/Auth.php @@ -28,7 +28,11 @@ class Auth extends Component // Verify password $hash = $user->getPassword(); if (strlen($hash) > 1 && password_verify($password, $hash)) { + $this->setIdentity($user->getId()); + + $this->_eventsManager->fire('auth:onLogin', $this, 'password'); + return true; } } @@ -68,6 +72,9 @@ class Auth extends Component } $this->setIdentity($user->getId()); + + $this->_eventsManager->fire('auth:onLogin', $this, + "OAuth {$auth['provider']}"); } /**