public function actionHistory()
 {
     $user_id = Yii::app()->user->getState('user_id');
     $objUser = UsersCards::model()->findByPk($user_id);
     $ops = Opslog::model()->findAllByAttributes(array('user_id' => $user_id));
     $this->render('history', array('ops' => $ops, 'user' => $objUser->name));
 }
示例#2
0
 public function authenticate()
 {
     $record = UsersCards::model()->findByAttributes(array('login' => $this->username));
     if ($record === null) {
         $this->errorCode = self::ERROR_USERNAME_INVALID;
     } elseif ($record->password !== md5($this->password)) {
         $this->errorCode = self::ERROR_PASSWORD_INVALID;
     } else {
         $this->_id = $record->id;
         $this->setState('role', $record->role);
         $this->setState('name', $record->name);
         $this->setState('user_id', $record->id);
         $this->errorCode = self::ERROR_NONE;
     }
     return !$this->errorCode;
 }