mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 08:09:33 +08:00
Revert "DEV: attempts to prevent session object to be retain in csrf init (#7743)"
This reverts commit 62c56b6e59
.
This commit is contained in:
parent
864222372f
commit
e6714d3531
|
@ -1,16 +1,15 @@
|
|||
// Append our CSRF token to AJAX requests when necessary.
|
||||
export default {
|
||||
name: "csrf-token",
|
||||
initialize(container) {
|
||||
const session = container.lookup("session:main");
|
||||
const csrfToken = $("meta[name=csrf-token]").attr("content");
|
||||
initialize: function(container) {
|
||||
var session = container.lookup("session:main");
|
||||
|
||||
// Add a CSRF token to all AJAX requests
|
||||
session.set("csrfToken", csrfToken);
|
||||
session.set("csrfToken", $("meta[name=csrf-token]").attr("content"));
|
||||
|
||||
$.ajaxPrefilter(function(options, originalOptions, xhr) {
|
||||
if (!options.crossDomain) {
|
||||
xhr.setRequestHeader("X-CSRF-Token", csrfToken);
|
||||
xhr.setRequestHeader("X-CSRF-Token", session.get("csrfToken"));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user