mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-20 16:38:22 +08:00
Enable CSRF validation by default.
This commit is contained in:
@@ -163,6 +163,12 @@ yii = (function ($) {
|
||||
init: function () {
|
||||
var $document = $(document);
|
||||
|
||||
$.ajaxPrefilter(function (options, originalOptions, xhr) {
|
||||
if (!options.crossDomain && pub.getCsrfVar()) {
|
||||
xhr.setRequestHeader('X-CSRF-TOKEN', pub.getCsrfToken());
|
||||
}
|
||||
});
|
||||
|
||||
$document.on('click.yii', pub.clickableSelector, function (event) {
|
||||
var $this = $(this);
|
||||
if (pub.allowAction($this)) {
|
||||
|
||||
Reference in New Issue
Block a user