{"action":"created","issue":{"url":"https://api.github.com/repos/edx/edx-platform/issues/6560","labels_url":"https://api.github.com/repos/edx/edx-platform/issues/6560/labels{/name}","comments_url":"https://api.github.com/repos/edx/edx-platform/issues/6560/comments","events_url":"https://api.github.com/repos/edx/edx-platform/issues/6560/events","html_url":"https://github.com/edx/edx-platform/pull/6560","id":54083620,"number":6560,"title":"Fix csrf error on studio login","user":{"login":"regisb","id":44319,"avatar_url":"https://avatars.githubusercontent.com/u/44319?v=3","gravatar_id":"","url":"https://api.github.com/users/regisb","html_url":"https://github.com/regisb","followers_url":"https://api.github.com/users/regisb/followers","following_url":"https://api.github.com/users/regisb/following{/other_user}","gists_url":"https://api.github.com/users/regisb/gists{/gist_id}","starred_url":"https://api.github.com/users/regisb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/regisb/subscriptions","organizations_url":"https://api.github.com/users/regisb/orgs","repos_url":"https://api.github.com/users/regisb/repos","events_url":"https://api.github.com/users/regisb/events{/privacy}","received_events_url":"https://api.github.com/users/regisb/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/edx/edx-platform/labels/engineering%20review","name":"engineering review","color":"c7def8"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-01-12T17:43:04Z","updated_at":"2015-01-27T20:55:07Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/edx/edx-platform/pulls/6560","html_url":"https://github.com/edx/edx-platform/pull/6560","diff_url":"https://github.com/edx/edx-platform/pull/6560.diff","patch_url":"https://github.com/edx/edx-platform/pull/6560.patch"},"body":"**Context:** We have witnessed multiple, seemingly random \"CSRF verification\r\nfailed\" errors while signing in (with valid ID) to the Studio.\r\n\r\n**Explanation:** The login form does not initially include a CSRF field.\r\nThe CSRF header of the request is appended to the studio login request\r\nheaders by intercepting the form validation. This intercept is performed\r\nby the login.js script. Unfortunately, the login.js script is loaded\r\npretty late (at the end of the template). So if the login form is\r\nvalidated sufficiently fast, the login.js script has no time to load and\r\nappend the X-CSRFToken header to the request.\r\n\r\n**Proposed solution:** the CSRF token is already passed to the template via\r\nthe login view, so we just add a hidden field to the login form to\r\ninclude the csrf token."},"comment":{"url":"https://api.github.com/repos/edx/edx-platform/issues/comments/71725892","html_url":"https://github.com/edx/edx-platform/pull/6560#issuecomment-71725892","issue_url":"https://api.github.com/repos/edx/edx-platform/issues/6560","id":71725892,"user":{"login":"sarina","id":1985317,"avatar_url":"https://avatars.githubusercontent.com/u/1985317?v=3","gravatar_id":"","url":"https://api.github.com/users/sarina","html_url":"https://github.com/sarina","followers_url":"https://api.github.com/users/sarina/followers","following_url":"https://api.github.com/users/sarina/following{/other_user}","gists_url":"https://api.github.com/users/sarina/gists{/gist_id}","starred_url":"https://api.github.com/users/sarina/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sarina/subscriptions","organizations_url":"https://api.github.com/users/sarina/orgs","repos_url":"https://api.github.com/users/sarina/repos","events_url":"https://api.github.com/users/sarina/events{/privacy}","received_events_url":"https://api.github.com/users/sarina/received_events","type":"User","site_admin":false},"created_at":"2015-01-27T20:55:07Z","updated_at":"2015-01-27T20:55:07Z","body":"ok to test"}}