protected function afterLogin($fromCookie) { parent::afterLogin($fromCookie); $this->updateSession(); $this->updateIdentity(); $this->recordlogintime(); $this->recordonline(); }
/** * Actions to be taken after logging in. * Overloads the parent method in order to mark superusers. * @param boolean $fromCookie whether the login is based on cookie. */ public function afterLogin($fromCookie) { parent::afterLogin($fromCookie); // Mark the user as a superuser if necessary. if (Rights::getAuthorizer()->isSuperuser($this->getId()) === true) { $this->isSuperuser = true; } }
protected function afterLogin($fromCookie) { if (null !== $this->model) { foreach ($this->model->attributes as $key => $value) { $this->setState($key, $value); } } return parent::afterLogin($fromCookie); }
public function afterLogin($fromCookie) { if (parent::beforeLogout()) { $user = User::model()->findByPk(Yii::app()->user->id); $user->last_login_time = new CDbExpression('NOW()'); $user->saveAttributes(array('last_login_time')); return parent::afterLogin($fromCookie); } else { return false; } }
/** * Actions to be taken after logging in. * Overloads the parent method in order to mark superusers. * @param boolean $fromCookie whether the login is based on cookie. */ public function afterLogin($fromCookie) { parent::afterLogin($fromCookie); // Mark the user as a superuser if necessary. //Get the user from the CActiveRecord $user = User::model()->findByPk($this->getId()); Yii::app()->getSession()->remove('current_user'); Yii::app()->getSession()->add('current_user', $user); if (Rights::getAuthorizer()->isSuperuser($this->getId()) === true) { $this->isSuperuser = true; } }
/** * Actions to be taken after logging in. * Overloads the parent method in order to mark superusers. * @param boolean $fromCookie whether the login is based on cookie. */ public function afterLogin($fromCookie) { parent::afterLogin($fromCookie); $command = Yii::app()->db->createCommand(); $command->select('username,user_url,display_name,email,fbuid,status,recent_login,avatar')->from('{{user}} u')->where('user_id=' . (int) $this->getId())->limit(1); $user = $command->queryRow(); //Add only some neccessary field if ($user) { // Set User States here $this->setState('current_user', $user); // Set User Roles here $this->setState('current_roles', User::getArrayRoles($this->getId())); if (Rights::getAuthorizer()->isSuperuser($this->getId()) === true) { $this->isSuperuser = true; } } else { throw new CHttpException(503, t('cms', 'Error while Logging into your account. Please try again later.')); } }
/** * Метод для действий после входа в систему: * * @param boolean $fromCookie - is authorize from cookie * * @return parent::afterLogin() */ protected function afterLogin($fromCookie) { Yii::app()->cache->clear('loggedIn' . $this->getId()); return parent::afterLogin($fromCookie); }
protected function afterLogin($fromCookie) { parent::afterLogin($fromCookie); $this->updateSession(); }
/** * Actions to be taken after logging in. * Overloads the parent method in order to mark superusers. * @param boolean $fromCookie whether the login is based on cookie. */ public function afterLogin($fromCookie) { parent::afterLogin($fromCookie); // Mark the user as a superuser if necessary. //Get the user from the CActiveRecord //$user=User::model()->findByPk($this->getId()); $command = Yii::app()->db->createCommand(); $command->select('username,user_url,display_name,email,fbuid,status,recent_login,avatar')->from('{{user}} u')->where('user_id=' . (int) $this->getId())->limit(1); $user = $command->queryRow(); //Add only some neccessary field if ($user) { Yii::app()->getSession()->remove('current_user'); Yii::app()->getSession()->add('current_user', $user); if (Rights::getAuthorizer()->isSuperuser($this->getId()) === true) { $this->isSuperuser = true; } } else { throw new CHttpException(503, t('Error while Logging into your account. Please try again later.')); } }
/** * afterLogin */ protected function afterLogin($fromCookie) { parent::afterLogin($fromCookie); $this->_updateUserState(); }
/** * Метод для действий после входа в систему: * * @param boolean $fromCookie - is authorize from cookie * * @return parent::afterLogin() */ protected function afterLogin($fromCookie) { Yii::app()->getCache()->clear('loggedIn' . $this->getId()); if ($fromCookie) { $transaction = Yii::app()->getDb()->beginTransaction(); try { $user = User::model()->active()->findByPk($this->getId()); if (null === $user) { $this->logout(); return false; } //перегенерировать токен авторизации $token = Yii::app()->userManager->tokenStorage->createCookieAuthToken($user, (int) Yii::app()->getModule('user')->sessionLifeTime * 24 * 60 * 60); $this->setState($this->authToken, $token->token); $this->setState(self::STATE_ACCESS_LEVEL, $user->access_level); $this->setState(self::STATE_NICK_NAME, $user->email); //дата входа $user->visit_time = new CDbExpression('NOW()'); $user->update(['visit_time']); $transaction->commit(); } catch (Exception $e) { $transaction->rollback(); } } parent::afterLogin($fromCookie); }
protected function afterLogin($fromCookie) { $this->updateUserDataOnLoginSuccess($fromCookie); return parent::afterLogin($fromCookie); }
/** * Метод для действий после входа в систему: * * @param boolean $fromCookie - is authorize from cookie * * @return parent::afterLogin() */ protected function afterLogin($fromCookie) { Yii::app()->cache->clear('loggedIn' . $this->getId()); if (true === $fromCookie) { $user = User::model()->active()->findByPk((int) $this->getId()); if (null === $user) { $this->logout(); return false; } $this->setState(self::STATE_ACCESS_LEVEL, $user->access_level); $this->setState(self::STATE_NICK_NAME, $user->nick_name); } parent::afterLogin($fromCookie); }
protected function afterLogin($fromCookie) { parent::afterLogin($fromCookie); //User::model()->updateLastLoginDate(Yii::app()->user->id); }