Skip to content

Commit

Permalink
Enh: JSON validation
Browse files Browse the repository at this point in the history
Signed-off-by: ArchBlood <[email protected]>
  • Loading branch information
ArchBlood authored Apr 9, 2024
1 parent 54b95b0 commit 84e6aeb
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions controllers/EditController.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,11 @@ public function actionComposer()
$model = new EditForm();
$model->composerData = file_get_contents($composerJsonFile);

if ($model->load(Yii::$app->request->post()) && $model->saveComposerData()) {
return ModalClose::widget(['saved' => true]);
if ($model->load(Yii::$app->request->post())) {
// Validate the model
if ($model->validate() && $model->saveComposerData()) {
return ModalClose::widget(['saved' => true]);
}
}

return $this->renderAjax('composer', [
Expand Down

0 comments on commit 84e6aeb

Please sign in to comment.