diff --git a/src/controllers/RecaptchaController.php b/src/controllers/RecaptchaController.php index ca62fd7..c4b0dc8 100644 --- a/src/controllers/RecaptchaController.php +++ b/src/controllers/RecaptchaController.php @@ -35,9 +35,10 @@ public function actionVerifySubmission() // if it's verified, then pass it on to the intended action, otherwise set a session error and return null if ($verified) { return Controller::run('/' . $action, func_get_args()); // run the intended action (add / to force it's scope to be outside the plugin) with all the params passed to this controller action - } else { - Craft::$app->getSession()->setError(Craft::t('site', 'Unable to verify your submission.')); - return null; } + + $error = 'Unable to verify your submission.'; + Craft::$app->getSession()->setError(Craft::t('site', $error)); + return $this->asFailure($error, [], ['message' => $error]); } }