protected function createSessionTable($db, $tableName) { parent::createSessionTable($db, $tableName); $db->createCommand()->addColumn($tableName, 'user_id', 'integer not null'); $db->createCommand()->addColumn($tableName, 'last_activity', 'datetime not null'); $db->createCommand()->addColumn($tableName, 'last_ip', 'string not null'); }
public function writeSession($id, $data) { if ($id == '') { //prevent the saving of blank ids into the user session table return false; } else { parent::writeSession($id, $data); } }
public function authenticate() { $user = User::model()->find('LOWER(username)=?', array(strtolower($this->username))); if ($user === null) { $this->errorCode = self::ERROR_USERNAME_INVALID; } else { if (!$user->validatePassword($this->password)) { $this->errorCode = self::ERROR_PASSWORD_INVALID; } else { $this->_id = $user->id; $this->username = $user->username; $this->errorCode = self::ERROR_NONE; //INICIO DE SESION $session = new CDbHttpSession(); $session->open(); $session['_nombre'] = $user->nombre; //$session['_id']=$user->id; //$session['_tipo']=$user->tipo; //$session['_username']=$user->username; //$session['_token']=$user->hashPassword($user->id,'62182048fd9cf9176'); } } return $this->errorCode == self::ERROR_NONE; }