From 353af6c647ae99d50f69fcaeecfee481a8cf468f Mon Sep 17 00:00:00 2001 From: Steven Hammerton Date: Mon, 12 Oct 2015 10:10:26 +0100 Subject: [PATCH] Move CasLogin logic to controller class and logic object in react-sdk --- src/skins/vector/views/organisms/CasLogin.js | 23 +++++--------------- 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/src/skins/vector/views/organisms/CasLogin.js b/src/skins/vector/views/organisms/CasLogin.js index 2a73fd3c..80b4cae1 100644 --- a/src/skins/vector/views/organisms/CasLogin.js +++ b/src/skins/vector/views/organisms/CasLogin.js @@ -20,25 +20,11 @@ var React = require('react'); var MatrixClientPeg = require('matrix-react-sdk/lib/MatrixClientPeg'); +var CasLoginController = require('matrix-react-sdk/lib/controllers/organisms/CasLogin'); + module.exports = React.createClass({ displayName: 'CasLogin', - - getInitialState: function() { - var splitLocation = window.location.href.split('/'); - return {serviceUrl: splitLocation[0] + "//" + splitLocation[2]}; - }, - - onCasClicked: function(ev) { - var serviceRedirectUrl = this.state.serviceUrl + "/#/login/cas"; - var self = this; - MatrixClientPeg.get().getCasServer().done(function(data) { - var serverUrl = data.serverUrl + "/login?service=" + encodeURIComponent(serviceRedirectUrl); - window.location.href=serverUrl - }, function(error) { - self.setStep("stage_m.login.cas"); - self.setState({errorText: 'Login failed.'}); - }); - }, + mixins: [CasLoginController], render: function() { return ( @@ -47,4 +33,5 @@ module.exports = React.createClass({ ); } -}); \ No newline at end of file + +});