public function run()
    {
        $model = Yii::createObject($this->modelClass);
        $event = $this->getFormEvent($model);

        $this->trigger(self::EVENT_BEFORE_SIGNUP, $event);

        $load = $model->load(Yii::$app->request->post());

        if (Yii::$app->request->isAjax) {
            Yii::$app->response->format = Response::FORMAT_JSON;

            return ActiveForm::validate($model);
        }

        if ($load && ($user = $model->signup()) !== null) {
            $this->trigger(self::EVENT_AFTER_SIGNUP, $event);
            if (Yii::$app->getUser()->login($user)) {
                return $this->redirectTo(Yii::$app->getUser()->getReturnUrl());
            }
        }

        return $this->controller->render($this->view, [
            'model' => $model,
        ]);
    }
public function run()
    {
        $model = Yii::createObject($this->modelClass);
        $event = $this->getFormEvent($model);

        $this->trigger(self::EVENT_BEFORE_SIGNUP, $event);

        $load = $model->load(Yii::$app->request->post());

        if (Yii::$app->request->isAjax) {
            Yii::$app->response->format = Response::FORMAT_JSON;

            return ActiveForm::validate($model);
        }

        if ($load && ($user = $model->signup()) !== null) {
            $this->trigger(self::EVENT_AFTER_SIGNUP, $event);
            if (Yii::$app->getUser()->login($user)) {
                return $this->redirectTo(Yii::$app->getUser()->getReturnUrl());
            }
        }

        return $this->controller->render($this->view, [
            'model' => $model,
        ]);
    }
public function run ( ) { $ model = Yii :: createObject ( $ this -> modelClass ) ; $ event = $ this -> getFormEvent ( $ model ) ; $ this -> trigger ( self :: EVENT_BEFORE_SIGNUP , $ event ) ; $ load = $ model -> load ( Yii :: $ app -> request -> post ( ) ) ; if ( Yii :: $ app -> request -> isAjax ) { Yii :: $ app -> response -> format = Response :: FORMAT_JSON ; return ActiveForm :: validate ( $ model ) ; } if ( $ load && ( $ user = $ model -> signup ( ) ) !== null ) { $ this -> trigger ( self :: EVENT_AFTER_SIGNUP , $ event ) ; if ( Yii :: $ app -> getUser ( ) -> login ( $ user ) ) { return $ this -> redirectTo ( Yii :: $ app -> getUser ( ) -> getReturnUrl ( ) ) ; } } return $ this -> controller -> render ( $ this -> view , [ 'model' => $ model , ] ) ; }
Signup a user.

@return string|\yii\web\Response
Signup a user .