User Session is not persisting when redirected

Hey guys,

I’m using yii 2.0 basic template, i’ve replaced the static user login for a database authenticated login.

When it comes to the validation with the database, everything works fine, when i call Yii::$app->user->login() it returns true, if i call Yii::$app->user->isGuest after it it would return false just like expected, the problem is that on the SiteController at the actionLogin function:

if ($model->load(Yii::$app->request->post()) && $model->login()) {

        return $this->goBack();

After this line is called it’s like the user never logged in, the session is cleared and i can’t figure out why.

I’m pretty sure i didn’t fuck up with any parts of the code, the only class i’ve changed to add the Database support was the User Model, like it is supposed to be. I didn’t touch the LoginForm.php or SiteController.php

The weird thing is that if i change the User Model to be static again, the session works with no problem.

Any ideas???