return $this->redirect([’/user/security/login’
return $this->redirect([’/user/security/login’
User get Registered first then logged in, You mean redirect to login after registration? What do you mean by auto login anyway?
register submit to load user pass to actionlogin
You want auto login user after registration? Hard to tell without seeing what are you trying to achieve.
return $this->redirect(['/user/security/login']);
change to action login
public function actionLogin()
{
if (!\Yii::$app->user->isGuest) {
$this->goHome();
}
/** @var LoginForm $model */
$model = \Yii::createObject(LoginForm::className());
$event = $this->getFormEvent($model);
$this->performAjaxValidation($model);
$this->trigger(self::EVENT_BEFORE_LOGIN, $event);
if ($model->load(\Yii::$app->getRequest()->post()) && $model->login()) {
Session::deleteAll('user_id = :user_id', [':user_id' => \Yii::$app->user->id]);
if (\Yii::$app->user->identity->user_status == \common\libs\Constants::user_status_active) {
$modelUserAccess = new UserAccessSearch();
$modelUserAccess->save_access();
$this->trigger(self::EVENT_AFTER_LOGIN, $event);
return $this->redirect(['/site/home']);
} else {
return $this->redirect(['/user/logout']);
}
}
help me plz