Buenas tardes, si alguien me pudiera colaborar; tengo una aplicacion hecha en yii, en local me corre perfectamente; pero cuando paso el sistema a produccion en un servidor linux; tengo problema con el login… con la clase UserIdentity en especifico la funcion authenticate; cuando hago el retorno de return $this->errorCode==self::ERROR_NONE; no me guarda el id del usuario, es como si la funcion ocasionara un error… si alguien le ha pasado o ha sabido de este problema… gracias de ante mano
UserIdentity.php
<?php
class UserIdentity extends CUserIdentity
{
private $_id;
public function authenticate()
{
$user=Usuario::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->setState('nombre', $user->nombre);
$this->username=$user->username;
$this->errorCode=self::ERROR_NONE;
}
return $this->errorCode==self::ERROR_NONE;
}
public function getId()
{
return $this->_id;
}
}
LoginForm.php
<?php
class LoginForm extends CFormModel
{
public $username;
public $password;
public $rememberMe;
public $password2;
public $password3;
private $_identity;
public function rules()
{
return array(
// username and password are required
array('username, password', 'required'),
// rememberMe needs to be a boolean
array('rememberMe', 'boolean'),
// password needs to be authenticated
array('password', 'authenticate'),
array('password3','compare','compareAttribute'=>'password2','allowEmpty'=>false, 'on'=>'cambio'),
array('username, password, password2, password3', 'required', 'on'=>'cambio'),
);
}
public function attributeLabels()
{
return array(
'rememberMe'=>'Recuerdame la Proxima vez',
'password2'=> 'Introduzca el Nuevo Password',
'password3'=> 'Repita el Nuevo Password',
);
}
public function authenticate($attribute,$params)
{
if(!$this->hasErrors())
{
$this->_identity=new UserIdentity($this->username,$this->password);
if(!$this->_identity->authenticate())
$this->addError('password','Usuario o Password Incorrecto.');
}
}
public function login()
{
if($this->_identity===null)
{
$this->_identity=new UserIdentity($this->username,$this->password);
$this->_identity->authenticate();
}
if($this->_identity->errorCode===UserIdentity::ERROR_NONE)
{
$duration=$this->rememberMe ? 3600 : 0; // 1 hora
Yii::app()->user->login($this->_identity,$duration);
return true;
}
else
return false;
}
public function getpassword($password)
{
return md5($password);
}
}
Cuando redireciona al Main lo hace de manera vacia por lo tanto no entra en el Menu