File tree Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -74,12 +74,20 @@ public function execute(
74
74
HttpResponseInterface $ response ,
75
75
string $ redirectOnFailureUrl
76
76
): void {
77
- $ reCaptchaResponse = $ this ->captchaResponseResolver ->resolve ($ request );
78
- $ validationConfig = $ this ->validationConfigResolver ->get ($ key );
79
77
80
- $ validationResult = $ this ->captchaValidator ->isValid ($ reCaptchaResponse , $ validationConfig );
81
- if (false === $ validationResult ->isValid ()) {
82
- $ this ->messageManager ->addErrorMessage ($ validationConfig ->getValidationFailureMessage ());
78
+ try {
79
+ $ reCaptchaResponse = $ this ->captchaResponseResolver ->resolve ($ request );
80
+ $ validationConfig = $ this ->validationConfigResolver ->get ($ key );
81
+
82
+ $ validationResult = $ this ->captchaValidator ->isValid ($ reCaptchaResponse , $ validationConfig );
83
+ if (false === $ validationResult ->isValid ()) {
84
+ $ this ->messageManager ->addErrorMessage ($ validationConfig ->getValidationFailureMessage ());
85
+ $ this ->actionFlag ->set ('' , Action::FLAG_NO_DISPATCH , true );
86
+
87
+ $ response ->setRedirect ($ redirectOnFailureUrl );
88
+ }
89
+ } catch (\Exception $ e ) {
90
+ $ this ->messageManager ->addErrorMessage ($ e ->getMessage ());
83
91
$ this ->actionFlag ->set ('' , Action::FLAG_NO_DISPATCH , true );
84
92
85
93
$ response ->setRedirect ($ redirectOnFailureUrl );
You can’t perform that action at this time.
0 commit comments