assert if csrf could not be found
This commit is contained in:
parent
6189e7a6dc
commit
beda8d5ece
@ -50,7 +50,12 @@ Cloudron.prototype.getOauthToken = function (user) {
|
|||||||
|
|
||||||
////////// get the login form (api/v1/session/login)
|
////////// get the login form (api/v1/session/login)
|
||||||
res = request.get(this._origin + urlp.pathname).set('cookie', sessionCookies[0]).query(urlp.query).end();
|
res = request.get(this._origin + urlp.pathname).set('cookie', sessionCookies[0]).query(urlp.query).end();
|
||||||
var csrf = res.text.match(/name="_csrf" value="(.*)"/)[1];
|
var csrfs = res.text.match(/name="_csrf" value="(.*)"/);
|
||||||
|
if (!csrfs) {
|
||||||
|
debug('Could not determine csrf', res.text, res.headers);
|
||||||
|
assert(false);
|
||||||
|
}
|
||||||
|
var csrf = csrfs[1];
|
||||||
sessionCookies = res.headers['set-cookie']; // always an array
|
sessionCookies = res.headers['set-cookie']; // always an array
|
||||||
assert.notStrictEqual(sessionCookies.length, 0);
|
assert.notStrictEqual(sessionCookies.length, 0);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user