44 if(Yii::app()->request->isPostRequest && Yii::app()->user->isGuest){
45 $record =
LoginAttempt::model()->findByAttributes(array(
'ip' => Yii::app()->request->userHostAddress));
48 $timeRemains = $this->blockTime - (time() - strtotime($record->updated));
49 $filterChain->controller->{$this->timeRemainsVar} = $timeRemains;
50 if( $timeRemains <= 0) {
51 $record->attempts = 0;
53 } elseif($record->attempts >= $this->attemptsCount){
55 $filterChain->controller->{$this->blockedVar} =
true;
69 protected function postFilter($filterChain)
72 if(Yii::app()->request->isPostRequest && Yii::app()->user->isGuest && $filterChain->controller->{$this->blockedVar} !==
true){
73 $ip = Yii::app()->request->userHostAddress;
76 if($record->attempts < $this->attemptsCount){
77 $record->attempts += 1;