separate Yii Event and namespace Event (#267)

This commit is contained in:
bscheshirwork
2018-10-17 10:04:16 +03:00
committed by Lorenzo Milesi
parent c0afdd55c9
commit 5181bbc60a

View File

@ -25,7 +25,7 @@ use yii\console\Application as ConsoleApplication;
use yii\i18n\PhpMessageSource;
use yii\web\Application as WebApplication;
use yii\base\Event;
use yii\base\Event as YiiEvent;
use Da\User\Event\FormEvent;
use Da\User\Controller\SecurityController;
@ -153,7 +153,7 @@ class Bootstrap implements BootstrapInterface
// Attach an event to check if the password has expired
if (!is_null(Yii::$app->getModule('user')->maxPasswordAge)) {
Event::on(SecurityController::class, FormEvent::EVENT_AFTER_LOGIN, function (FormEvent $event) {
YiiEvent::on(SecurityController::class, FormEvent::EVENT_AFTER_LOGIN, function (FormEvent $event) {
$user = $event->form->user;
if ($user->password_age >= Yii::$app->getModule('user')->maxPasswordAge) {
// Force password change