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?
1 Like
register submit to load user pass to actionlogin
1 Like
You want auto login user after registration? Hard to tell without seeing what are you trying to achieve.
1 Like
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']);
}
}
1 Like
help me plz
1 Like