Пример #1
0
 public function actionPassword_recover()
 {
     if (\yii\helpers\ArrayHelper::getValue(Yii::$app->params, 'isTransfere', false) == true) {
         throw new Exception(Yii::$app->params['isTransfere_string']);
     }
     $model = new \app\models\Form\PasswordRecover();
     $model->setScenario('insert');
     if (Yii::$app->request->isAjax && $model->load(Yii::$app->request->post())) {
         $model->setScenario('ajax');
         Yii::$app->response->format = Response::FORMAT_JSON;
         return ActiveForm::validate($model);
     }
     if ($model->load(Yii::$app->request->post()) && $model->send()) {
         Yii::$app->session->setFlash('contactFormSubmitted');
         return $this->refresh();
     } else {
         return $this->render(['model' => $model]);
     }
 }
Пример #2
0
 public function actionPassword_recover()
 {
     $model = new \app\models\Form\PasswordRecover();
     $model->setScenario('insert');
     if (Yii::$app->request->isAjax && $model->load(Yii::$app->request->post())) {
         $model->setScenario('ajax');
         Yii::$app->response->format = Response::FORMAT_JSON;
         return ActiveForm::validate($model);
     }
     if ($model->load(Yii::$app->request->post()) && $model->send()) {
         Yii::$app->session->setFlash('contactFormSubmitted');
         return $this->refresh();
     } else {
         return $this->render(['model' => $model]);
     }
 }