cpucpu
(Soyhobo)
1
Using yii-1.1.7.r3135 and a fairly new project file structure, 1 only model (TblArticle)
I am basically just starting, can’t log a user, my eyes are burning.
-Try to create an article so that it asks you to log in
-See the log at the end of the page
-Try to log and see log again to see the process.
The app is "logging" ($model->login() == true) but not logging (Yii::app()->user->isGuest == 1)
Here i place some code:
action/login: http://paste.pocoo.org/show/393952/
model formLogin: http://paste.pocoo.org/show/393953/
UserIdentity: http://paste.pocoo.org/show/393954/
This should be something very dumb i guess, if you can help me I’ll be very glad.
cpucpu
(Soyhobo)
2
Ok, ok, I simplified the thing, what about this:
public function actionIndex()
{
$this->render('index');
Yii::trace(Yii::app()->user->isGuest);
}
public function actionLogin()
{
$identity=new UserIdentity('admin', 'admin');
$identity->authenticate();
if($identity->errorCode === UserIdentity::ERROR_NONE)
{
Yii::app()->user->login($identity);
$this->redirect(Yii::app()->user->returnUrl);
}
else
{
$this->render('error', $identity->errorMessage);
}
}
What is SO wrong in that that I CANNOT login by just pressing the login button
Test it by yourself: http://azulacero.byethost17.com/app/index.php
mdomba
(Maurizio Domba Cerin)
3
The code seems OK… the link you post is not working, gives error: Página no encontrada
cpucpu
(Soyhobo)
4
The problem was _id was not set in CUserIdentity, and no error was thrown despite it is critical for login to work.