From 313c0573e302a43180f7dc1f2dd2ac94a53cb30d Mon Sep 17 00:00:00 2001 From: Johannes Zellner Date: Fri, 15 Apr 2016 17:23:58 +0200 Subject: [PATCH] Instead of returning a null token, assert --- cloudron.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cloudron.js b/cloudron.js index dfa33d1..64dd8c2 100644 --- a/cloudron.js +++ b/cloudron.js @@ -63,7 +63,10 @@ Cloudron.prototype.getOauthToken = function (user) { ////////// submit the login form with credentials res = request.post(this._origin + urlp.pathname).set('cookie', sessionCookies[0]).send({ _csrf: csrf, username: username, password: password }).redirects(0).end(); - if (res.statusCode !== 302) return null; + if (res.statusCode !== 302) { + debug('Failed to submit the login for.', res.statusCode, res.text); + assert(false); + } sessionCookies = res.headers['set-cookie']; // always an array assert.notStrictEqual(sessionCookies.length, 0);