Fix CAS support by using a temporary Matrix client

Signed-off-by: Shell Turner <cam.turn@gmail.com>
This commit is contained in:
Shell Turner 2016-09-09 18:21:31 +01:00
parent 14227b5718
commit 1380bf705a
3 changed files with 18 additions and 11 deletions

View file

@ -6,6 +6,7 @@ var MatrixClientPeg = require("./MatrixClientPeg");
var SignupStages = require("./SignupStages");
var dis = require("./dispatcher");
var q = require("q");
var url = require("url");
const EMAIL_STAGE_TYPE = "m.login.email.identity";
@ -413,6 +414,15 @@ class Login extends Signup {
throw error;
});
}
redirectToCas() {
var client = this._createTemporaryClient();
var parsedUrl = url.parse(window.location.href, true);
parsedUrl.query["homeserver"] = client.getHomeserverUrl();
parsedUrl.query["identityServer"] = client.getIdentityServerUrl();
var casUrl = client.getCasLoginUrl(url.format(parsedUrl));
window.location.href = casUrl;
}
}
module.exports.Register = Register;