vdlp/oc-csrf-plugin

Adds CSRF protection to October CMS frontend.

Installs: 11 776

Dependents: 0

Suggesters: 0

Security: 0

Stars: 4

Watchers: 7

Forks: 2

Open Issues: 0

Type:october-plugin

2.0.4 2022-03-08 08:39 UTC

This package is auto-updated.

Last update: 2022-05-08 08:58:43 UTC


README

Adds CSRF protection.

Requirements

  • PHP 7.4 or higher
  • October CMS 1.0 or higher

Installation

composer require vdlp/oc-csrf-plugin

Configuration

Add the plugin configuration to your config folder:

php artisan vendor:publish --provider="Vdlp\Csrf\ServiceProviders\CsrfServiceProvider" --tag="vdlp-csrf-config"

Add the CSRF token to the <head> section:

<meta name="csrf-token" content="{{ csrf_token() }}">

Add the CSRF token to the AJAX requests:

<script type="text/javascript">
$.ajaxSetup({
    headers: {
        'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
    }
});
</script>

Questions? Need help?

If you have any question about how to use this plugin, please don't hesitate to contact us at octobercms@vdlp.nl. We're happy to help you.