Hi
I have made a new web application using yii freamework and test it locally on my machine (ubuntu) and everything worked as expected.
but when i uploded it to shared hosting I faced a [size="2"] real weird problem with useridentity .[/size]
After logging in with the right username and password the login form returns me to the index page with no error beside that the Yii::app()->user->isGuest =true which means that the user is not logged in.
[size="2"]here is the code of [/size][size="3"]protected/components/UserIdentity.php[/size]
[size="2"]
[/size]class UserIdentity extends CUserIdentity {
private $_id;
private $_username;
private $_isAdmin = true;
/**
* Authenticates a user.
* The example implementation makes sure if the username and password
* are both 'demo'.
* In practical applications, this should be changed to authenticate
* against some persistent user identity storage (e.g. database).
* @return boolean whether authentication succeeds.
*/
public function authenticate() {
$user = User::model()->findByAttributes(array('username' => $this->username));
if ($user === NULL) {
$this->errorCode = self::ERROR_USERNAME_INVALID;
} elseif ($user->password !== $this->password) {
$this->errorCode = self::ERROR_PASSWORD_INVALID;
} else {
$this->errorCode = self::ERROR_NONE;
$this->setState('role', $user->role);
$this->_id = $user->user_id;
$this->_username = $user->username;
$this->_isAdmin = TRUE;
if ($user->role == 'admin') {
$this->setState('isAdmin', TRUE);
} else {
$this->setState('isAdmin', FALSE);
}
}
return !$this->errorCode;
}
public function getId() {
return $this->_id;
}
public function getUsername() {
return $this->_username;
}
}[size=2]
[/size]
[size="3"]as you can see in the authenticate method, [/size]
[size="3"]also I uploaded a fresh copy of web-application generated with yiic to test the login but it did work either. same problem occurred after logining in with (user:admin & password:admin ) no username where displayed instead of login item in the menu bar,[/size]
[size="3"]can any body help with this issue,
[/size]thanks in advanced,