public function actionForget() { $this->layout = '/layouts/index'; $model = new ForgetForm(); if (($post = $this->request->getPost('ForgetForm', false)) != false) { $post['password'] = $this->grantePassword(); $model->attributes = $post; if ($model->save()) { $this->render('forget', ['model' => $model, 'success' => true]); } else { $this->render('forget', ['model' => $model, 'success' => false]); } return; } $this->render('forget', ['model' => $model]); }