frontend/controllers/SiteController.php
/**
     * Displays SHU page for create new account.
     * (depricated cause created this page on sh-domain)
     * @return string|Response
     * @throws BadRequestHttpException
     */
Displays SHU page for create new account.
(depricated cause created this page on sh-domain)
@return string|Response
@throws BadRequestHttpException
Displays SHU page for create new account . ( depricated cause created this page on sh - domain ) @return string|Response @throws BadRequestHttpException
public function actionSelfHosted()
    {
        $model = new SelfHostUserForm();
        if (Yii::$app->request->isAjax && $model->load(Yii::$app->request->post())) {
            Yii::$app->response->format = Response::FORMAT_JSON;
            return ActiveForm::validate($model);
        }
        if ($this->User) {
            $model->shu_email = $this->User->user_email;
        }
        if ($model->load(Yii::$app->request->post())) {
            if ($model->validate()) {
                $cnt = Yii::$app->cache->get(Yii::$app->params['ShuCacheKey']);
                if (!$cnt) {
                    $cnt = 1;
                } else {
                    $cnt++;
                }
                Yii::$app->cache->set(Yii::$app->params['ShuCacheKey'], $cnt);
                $ret = $model->signup();
                if ($ret['user']) {
                    return $this->redirect(Yii::getAlias('@selfHostedWeb') .
                        '/site/login-by-token?token=' . $ret['user']->password_reset_token .
                        '&free=' . $ret['free']);
                } else {
                    throw new BadRequestHttpException('Wrong form data2');
                }
            } else {
                throw new BadRequestHttpException('Wrong form data');
            }
        } else {
            return $this->render('self-hosted', [
                'model' => $model,
                'user' => $this->User,
            ]);
        }
    }
public function actionSelfHosted ( ) { $ model = new SelfHostUserForm ( ) ; if ( Yii :: $ app -> request -> isAjax && $ model -> load ( Yii :: $ app -> request -> post ( ) ) ) { Yii :: $ app -> response -> format = Response :: FORMAT_JSON ; return ActiveForm :: validate ( $ model ) ; } if ( $ this -> User ) { $ model -> shu_email = $ this -> User -> user_email ; } if ( $ model -> load ( Yii :: $ app -> request -> post ( ) ) ) { if ( $ model -> validate ( ) ) { $ cnt = Yii :: $ app -> cache -> get ( Yii :: $ app -> params [ 'ShuCacheKey' ] ) ; if ( ! $ cnt ) { $ cnt = 1 ; } else { $ cnt ++ ; } Yii :: $ app -> cache -> set ( Yii :: $ app -> params [ 'ShuCacheKey' ] , $ cnt ) ; $ ret = $ model -> signup ( ) ; if ( $ ret [ 'user' ] ) { return $ this -> redirect ( Yii :: getAlias ( '@selfHostedWeb' ) . '/site/login-by-token?token=' . $ ret [ 'user' ] -> password_reset_token . '&free=' . $ ret [ 'free' ] ) ; } else { throw new BadRequestHttpException ( 'Wrong form data2' ) ; } } else { throw new BadRequestHttpException ( 'Wrong form data' ) ; } } else { return $ this -> render ( 'self-hosted' , [ 'model' => $ model , 'user' => $ this -> User , ] ) ; } }
Displays SHU page for create new account.
Displays SHU page for create new account .
//var_dump($ret['user']); exit;