mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-05 17:51:40 +09:00
Remove duplicate CSRF token from AJAX requests
This commit is contained in:
parent
2830632a93
commit
e80b0d4570
1 changed files with 9 additions and 4 deletions
|
|
@ -441,11 +441,16 @@ Rhymix.ajax = function(action, params, success, error) {
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Add a CSRF token.
|
// Add a CSRF token to the header, and remove it from the parameters
|
||||||
const headers = {};
|
const headers = {
|
||||||
if (action !== null) {
|
'X-CSRF-Token': getCSRFToken()
|
||||||
headers['X-CSRF-Token'] = getCSRFToken();
|
|
||||||
};
|
};
|
||||||
|
if (isFormData && params.has('_rx_csrf_token') && params.get('_rx_csrf_token') === headers['X-CSRF-Token']) {
|
||||||
|
params.delete('_rx_csrf_token');
|
||||||
|
}
|
||||||
|
if (typeof params._rx_csrf_token !== 'undefined' && params._rx_csrf_token === headers['X-CSRF-Token']) {
|
||||||
|
delete params._rx_csrf_token;
|
||||||
|
}
|
||||||
|
|
||||||
// Generate AJAX parameters
|
// Generate AJAX parameters
|
||||||
const args = {
|
const args = {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue