本文整理汇总了PHP中CWebUser::afterLogin方法的典型用法代码示例。如果您正苦于以下问题:PHP CWebUser::afterLogin方法的具体用法?PHP CWebUser::afterLogin怎么用?PHP CWebUser::afterLogin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CWebUser
的用法示例。
在下文中一共展示了CWebUser::afterLogin方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: afterLogin
protected function afterLogin($fromCookie)
{
parent::afterLogin($fromCookie);
$this->updateSession();
$this->updateIdentity();
$this->recordlogintime();
$this->recordonline();
}
示例2: afterLogin
/**
* 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;
}
}
示例3: afterLogin
protected function afterLogin($fromCookie)
{
if (null !== $this->model) {
foreach ($this->model->attributes as $key => $value) {
$this->setState($key, $value);
}
}
return parent::afterLogin($fromCookie);
}
示例4: afterLogin
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;
}
}
示例5: afterLogin
/**
* 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;
}
}
示例6: afterLogin
/**
* 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.'));
}
}
示例7: afterLogin
/**
* Метод для действий после входа в систему:
*
* @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);
}
示例8: afterLogin
protected function afterLogin($fromCookie)
{
parent::afterLogin($fromCookie);
$this->updateSession();
}
示例9: afterLogin
/**
* 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.'));
}
}
示例10: afterLogin
/**
* afterLogin
*/
protected function afterLogin($fromCookie)
{
parent::afterLogin($fromCookie);
$this->_updateUserState();
}
示例11: afterLogin
/**
* Метод для действий после входа в систему:
*
* @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);
}
示例12: afterLogin
protected function afterLogin($fromCookie)
{
$this->updateUserDataOnLoginSuccess($fromCookie);
return parent::afterLogin($fromCookie);
}
示例13: afterLogin
/**
* Метод для действий после входа в систему:
*
* @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);
}
示例14: afterLogin
protected function afterLogin($fromCookie)
{
parent::afterLogin($fromCookie);
//User::model()->updateLastLoginDate(Yii::app()->user->id);
}