Thanks for this! it is very helpful!! Should a csrf token also be used in the form? if so, how do we verify it in the controller action?
Yes, CSRF can also be used in the controller you need to write this code in the controller
# CSRF Protection my $v = $c->validation; return $c->render( template => 'not_found.html.ep', status => 403 ) if $v->csrf_protect->has_error('csrf_token');
And in the Template
%= form_for '/form_action_url => ( method => 'post', name => 'form_name' ) => begin <!-- Other Form Fields --> %= csrf_field % end
That's it. You are good to with.
We're a place where coders share, stay up-to-date and grow their careers.
Thanks for this! it is very helpful!! Should a csrf token also be used in the form? if so, how do we verify it in the controller action?
Yes, CSRF can also be used in the controller you need to write this code in the controller
And in the Template
That's it. You are good to with.