mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-03 08:41:39 +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.
|
||||
const headers = {};
|
||||
if (action !== null) {
|
||||
headers['X-CSRF-Token'] = getCSRFToken();
|
||||
// Add a CSRF token to the header, and remove it from the parameters
|
||||
const 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
|
||||
const args = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue