Merge pull request #459 from VShell/fix-cas

Fix CAS support by using a temporary Matrix client
This commit is contained in:
Matthew Hodgson 2016-09-09 21:19:19 +01:00 committed by GitHub
commit 86da0e0d63
3 changed files with 18 additions and 11 deletions

View file

@ -16,26 +16,19 @@ limitations under the License.
'use strict';
var MatrixClientPeg = require("../../../MatrixClientPeg");
var React = require('react');
var url = require("url");
module.exports = React.createClass({
displayName: 'CasLogin',
onCasClicked: function(ev) {
var cli = MatrixClientPeg.get();
var parsedUrl = url.parse(window.location.href, true);
parsedUrl.query["homeserver"] = cli.getHomeserverUrl();
parsedUrl.query["identityServer"] = cli.getIdentityServerUrl();
var casUrl = MatrixClientPeg.get().getCasLoginUrl(url.format(parsedUrl));
window.location.href = casUrl;
propTypes: {
onSubmit: React.PropTypes.func, // fn()
},
render: function() {
return (
<div>
<button onClick={this.onCasClicked}>Sign in with CAS</button>
<button onClick={this.props.onSubmit}>Sign in with CAS</button>
</div>
);
}