I have a strange issue with session. I’m using a basic template and copied user auth code from advanced app.
So after I fill login info in login form this code executes:
public function actionLogin()
{
if (!\Yii::$app->user->isGuest) {
return $this->goHome();
}
$model = new LoginForm();
if ($model->load(Yii::$app->request->post()) && $model->login()) {
echo '<pre>';
print_r(Yii::$app->user->identity->email); // <- I SEE MY EMAIL HERE
echo '</pre>';
return $this->goHome();
} else {
return $this->render('login', [
'model' => $model,
]);
}
}
So model validates and logins user. But after $this->goHome(); - user appears on the login page again and logged out (guest). Any ideas why this happens? Maybe its connected somehow to auth_key ?