diff --git a/src/Signup.js b/src/Signup.js
index 1ac92f3218..eaf1906059 100644
--- a/src/Signup.js
+++ b/src/Signup.js
@@ -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;
diff --git a/src/components/structures/login/Login.js b/src/components/structures/login/Login.js
index 0315a3186a..ff4ad576f1 100644
--- a/src/components/structures/login/Login.js
+++ b/src/components/structures/login/Login.js
@@ -92,6 +92,10 @@ module.exports = React.createClass({
}).done();
},
+ onCasLogin: function() {
+ this._loginLogic.redirectToCas();
+ },
+
_onLoginAsGuestClick: function() {
var self = this;
self.setState({
@@ -228,7 +232,7 @@ module.exports = React.createClass({
);
case 'm.login.cas':
return (
-