mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-11 19:20:01 +08:00
Fix problem, that Application::getUser can return null
This commit is contained in:
@@ -67,7 +67,7 @@ class RateLimiter extends ActionFilter
|
||||
*/
|
||||
public function beforeAction($action)
|
||||
{
|
||||
$user = $this->user ? : Yii::$app->getUser()->getIdentity(false);
|
||||
$user = $this->user ? : (Yii::$app->getUser() ? Yii::$app->getUser()->getIdentity(false) : null);
|
||||
if ($user instanceof RateLimitInterface) {
|
||||
Yii::trace('Check rate limit', __METHOD__);
|
||||
$this->checkRateLimit(
|
||||
|
||||
Reference in New Issue
Block a user