Hello,
I have a problem with overwriting the message returned when a csrf element is incorrectly validated.
When the element name is other than csrf e.g. post_csfr I keep getting the error “The form submitted did not originate from the expected site”.
[
'name' => 'post_csrf',
'required' => true,
'filters' => [
['name' => \Laminas\Filter\StripTags::class],
['name' => \Laminas\Filter\StringTrim::class],
],
'validators' => [
[
'name' => \Laminas\Validator\NotEmpty::class,
],
[
'name' => \Laminas\Validator\Csrf::class,
'options' => [
'messages' => [
\Laminas\Validator\Csrf::NOT_SAME => 'my error message',
],
],
],
],
],
Is this part of the code correct/allowed (I get the expected result when the input name is “csrf”):
[
'name' => \Laminas\Validator\Csrf::class,
'options' => [
'messages' => [
\Laminas\Validator\Csrf::NOT_SAME => 'my error message',
],
],
],