Merge pull request #4763 from vvanpo/fork-master
JSON API parsing error on CSRF exception: single quotes in ['BAD CSRF'] is invalid JSON
This commit is contained in:
commit
e600dca268
|
@ -69,7 +69,7 @@ export function ajax() {
|
|||
args.error = (xhr, textStatus, errorThrown) => {
|
||||
// note: for bad CSRF we don't loop an extra request right away.
|
||||
// this allows us to eliminate the possibility of having a loop.
|
||||
if (xhr.status === 403 && xhr.responseText === "['BAD CSRF']") {
|
||||
if (xhr.status === 403 && xhr.responseText === "[\"BAD CSRF\"]") {
|
||||
Discourse.Session.current().set('csrfToken', null);
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ class ApplicationController < ActionController::Base
|
|||
unless is_api? || is_user_api?
|
||||
super
|
||||
clear_current_user
|
||||
render text: "['BAD CSRF']", status: 403
|
||||
render text: "[\"BAD CSRF\"]", status: 403
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue