php - Custom Identity loses session information -
for reason, after logging in, user details gets lost.
i created customer
class, implemented identityinterface
, extended activerecord
class.
when customer logs in, customer authenticated. noticed @ point (using var_dump) yii::$app->user
set appropriate customer
instance, , noticed yii::$app->session
enabled. right after $model->login()
function; $model
here instance of de-facto loginform
below.
public function login() { if ($this->validate()) { return yii::$app->user->login($this->getcustomer(), $this->rememberme ? 3600 * 24 * 30 : 0); } else { return false; } }
however, after redirect in $this->goback()
, noticed yii::$app->user
— once instance of yii\web\user
, identityclass @ app/models/customer
— null
. noticed session @ point (immediately after redirect) null
.
this means yii::$app->user->isguest
true
after customer has been authenticated.
how carry logged-in user along through redirect?
Comments
Post a Comment