Beispiel #1
0
 protected function afterLogin($fromCookie)
 {
     parent::afterLogin($fromCookie);
     $this->updateSession();
     $this->updateIdentity();
     $this->recordlogintime();
     $this->recordonline();
 }
Beispiel #2
0
 /**
  * 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;
     }
 }
Beispiel #3
0
 protected function afterLogin($fromCookie)
 {
     if (null !== $this->model) {
         foreach ($this->model->attributes as $key => $value) {
             $this->setState($key, $value);
         }
     }
     return parent::afterLogin($fromCookie);
 }
Beispiel #4
0
 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;
     }
 }
Beispiel #5
0
 /**
  * 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;
     }
 }
Beispiel #6
0
 /**
  * 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.'));
     }
 }
Beispiel #7
0
 /**
  * Метод для действий после входа в систему:
  *
  * @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);
 }
Beispiel #8
0
 protected function afterLogin($fromCookie)
 {
     parent::afterLogin($fromCookie);
     $this->updateSession();
 }
Beispiel #9
0
 /**
  * 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.'));
     }
 }
Beispiel #10
0
 /**
  * afterLogin 
  */
 protected function afterLogin($fromCookie)
 {
     parent::afterLogin($fromCookie);
     $this->_updateUserState();
 }
Beispiel #11
0
 /**
  * Метод для действий после входа в систему:
  *
  * @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);
 }
Beispiel #12
0
 protected function afterLogin($fromCookie)
 {
     $this->updateUserDataOnLoginSuccess($fromCookie);
     return parent::afterLogin($fromCookie);
 }
Beispiel #13
0
 /**
  * Метод для действий после входа в систему:
  *
  * @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);
 }