public function actionCreate() { $model = new Usuario(); if (\Kanda::$post->post($model)) { if ($_POST['senha'] != 123 && $_POST['senha'] == $_POST['confirm_senha']) { $_POST['senha'] = password_hash($_POST['senha'], PASSWORD_DEFAULT); unset($_POST['confirm_senha']); } else { \Kanda::$app->session->setflash('update', 'Senha inválida', 'warning'); return $this->redirect('create'); } $model = new Usuario($_POST); $model->save(false); \Kanda::$app->session->setflash('create', 'Cadastrado com sucesso'); return $this->redirect(); } else { return $this->render('form', ['model' => $model, 'nivel' => new Nivel()]); } }