mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
get csrf token from /dev/csrf not /register
This commit is contained in:
parent
b51ee7ea7e
commit
938d22da3f
1 changed files with 2 additions and 5 deletions
|
@ -161,13 +161,10 @@ class User
|
|||
|
||||
getCsrfToken: (callback = (error) ->) ->
|
||||
@request.get {
|
||||
url: "/register"
|
||||
url: "/dev/csrf"
|
||||
}, (err, response, body) =>
|
||||
return callback(err) if err?
|
||||
csrfMatches = body.match("window.csrfToken = \"(.*?)\";")
|
||||
if !csrfMatches?
|
||||
return callback(new Error("no csrf token found"))
|
||||
@csrfToken = csrfMatches[1]
|
||||
@csrfToken = body
|
||||
@request = @request.defaults({
|
||||
headers:
|
||||
"x-csrf-token": @csrfToken
|
||||
|
|
Loading…
Reference in a new issue