commit
						c61031d3e1
					
				|  | @ -142,6 +142,17 @@ limitations under the License. | |||
|     color: $primary-fg-color; | ||||
| } | ||||
| 
 | ||||
| .mx_Login_sso_link { | ||||
|     display: block; | ||||
|     text-align: center; | ||||
|     font-size: 15px; | ||||
|     margin-bottom: 20px; | ||||
| } | ||||
| 
 | ||||
| .mx_Login_sso_link:link { | ||||
|     color: $primary-fg-color; | ||||
| } | ||||
| 
 | ||||
| .mx_Login_loader { | ||||
|     display: inline; | ||||
|     position: relative; | ||||
|  |  | |||
|  | @ -16,7 +16,6 @@ limitations under the License. | |||
| */ | ||||
| 
 | ||||
| import Matrix from "matrix-js-sdk"; | ||||
| import { _t } from "./languageHandler"; | ||||
| 
 | ||||
| import Promise from 'bluebird'; | ||||
| import url from 'url'; | ||||
|  | @ -225,19 +224,18 @@ export default class Login { | |||
|         }); | ||||
|     } | ||||
| 
 | ||||
|     redirectToCas() { | ||||
|     getSsoLoginUrl(loginType) { | ||||
|       const client = this._createTemporaryClient(); | ||||
|       const parsedUrl = url.parse(window.location.href, true); | ||||
| 
 | ||||
|       // XXX: at this point, the fragment will always be #/login, which is no
 | ||||
|       // use to anyone. Ideally, we would get the intended fragment from
 | ||||
|       // MatrixChat.screenAfterLogin so that you could follow #/room links etc
 | ||||
|       // through a CAS login.
 | ||||
|       // through an SSO login.
 | ||||
|       parsedUrl.hash = ""; | ||||
| 
 | ||||
|       parsedUrl.query["homeserver"] = client.getHomeserverUrl(); | ||||
|       parsedUrl.query["identityServer"] = client.getIdentityServerUrl(); | ||||
|       const casUrl = client.getCasLoginUrl(url.format(parsedUrl)); | ||||
|       window.location.href = casUrl; | ||||
|       return client.getSsoLoginUrl(url.format(parsedUrl), loginType); | ||||
|     } | ||||
| } | ||||
|  |  | |||
|  | @ -84,7 +84,10 @@ module.exports = React.createClass({ | |||
|         // letting you do that login type
 | ||||
|         this._stepRendererMap = { | ||||
|             'm.login.password': this._renderPasswordStep, | ||||
|             'm.login.cas': this._renderCasStep, | ||||
| 
 | ||||
|             // CAS and SSO are the same thing, modulo the url we link to
 | ||||
|             'm.login.cas': () => this._renderSsoStep(this._loginLogic.getSsoLoginUrl("cas")), | ||||
|             'm.login.sso': () => this._renderSsoStep(this._loginLogic.getSsoLoginUrl("sso")), | ||||
|         }; | ||||
| 
 | ||||
|         this._initLoginLogic(); | ||||
|  | @ -186,10 +189,6 @@ module.exports = React.createClass({ | |||
|         }).done(); | ||||
|     }, | ||||
| 
 | ||||
|     onCasLogin: function() { | ||||
|       this._loginLogic.redirectToCas(); | ||||
|     }, | ||||
| 
 | ||||
|     _onLoginAsGuestClick: function() { | ||||
|         const self = this; | ||||
|         self.setState({ | ||||
|  | @ -403,10 +402,9 @@ module.exports = React.createClass({ | |||
|         ); | ||||
|     }, | ||||
| 
 | ||||
|     _renderCasStep: function() { | ||||
|         const CasLogin = sdk.getComponent('login.CasLogin'); | ||||
|     _renderSsoStep: function(url) { | ||||
|         return ( | ||||
|             <CasLogin onSubmit={this.onCasLogin} /> | ||||
|             <a href={url} className="mx_Login_sso_link">{ _t('Sign in with single sign-on') }</a> | ||||
|         ); | ||||
|     }, | ||||
| 
 | ||||
|  |  | |||
|  | @ -1,38 +0,0 @@ | |||
| /* | ||||
| Copyright 2015, 2016 OpenMarket Ltd | ||||
| 
 | ||||
| Licensed under the Apache License, Version 2.0 (the "License"); | ||||
| you may not use this file except in compliance with the License. | ||||
| You may obtain a copy of the License at | ||||
| 
 | ||||
|     http://www.apache.org/licenses/LICENSE-2.0
 | ||||
| 
 | ||||
| Unless required by applicable law or agreed to in writing, software | ||||
| distributed under the License is distributed on an "AS IS" BASIS, | ||||
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
| See the License for the specific language governing permissions and | ||||
| limitations under the License. | ||||
| */ | ||||
| 
 | ||||
| 'use strict'; | ||||
| 
 | ||||
| import React from 'react'; | ||||
| import PropTypes from 'prop-types'; | ||||
| import { _t } from '../../../languageHandler'; | ||||
| 
 | ||||
| module.exports = React.createClass({ | ||||
|     displayName: 'CasLogin', | ||||
| 
 | ||||
|     propTypes: { | ||||
|       onSubmit: PropTypes.func, // fn()
 | ||||
|     }, | ||||
| 
 | ||||
|     render: function() { | ||||
|         return ( | ||||
|             <div> | ||||
|                 <button onClick={this.props.onSubmit}>{ _t("Sign in with CAS") }</button> | ||||
|             </div> | ||||
|         ); | ||||
|     }, | ||||
| 
 | ||||
| }); | ||||
|  | @ -640,7 +640,6 @@ | |||
|     "Message removed": "Message removed", | ||||
|     "Robot check is currently unavailable on desktop - please use a <a>web browser</a>": "Robot check is currently unavailable on desktop - please use a <a>web browser</a>", | ||||
|     "This Home Server would like to make sure you are not a robot": "This Home Server would like to make sure you are not a robot", | ||||
|     "Sign in with CAS": "Sign in with CAS", | ||||
|     "Custom Server Options": "Custom Server Options", | ||||
|     "You can use the custom server options to sign into other Matrix servers by specifying a different Home server URL.": "You can use the custom server options to sign into other Matrix servers by specifying a different Home server URL.", | ||||
|     "This allows you to use this app with an existing Matrix account on a different home server.": "This allows you to use this app with an existing Matrix account on a different home server.", | ||||
|  | @ -1225,6 +1224,7 @@ | |||
|     "Error: Problem communicating with the given homeserver.": "Error: Problem communicating with the given homeserver.", | ||||
|     "Can't connect to homeserver via HTTP when an HTTPS URL is in your browser bar. Either use HTTPS or <a>enable unsafe scripts</a>.": "Can't connect to homeserver via HTTP when an HTTPS URL is in your browser bar. Either use HTTPS or <a>enable unsafe scripts</a>.", | ||||
|     "Can't connect to homeserver - please check your connectivity, ensure your <a>homeserver's SSL certificate</a> is trusted, and that a browser extension is not blocking requests.": "Can't connect to homeserver - please check your connectivity, ensure your <a>homeserver's SSL certificate</a> is trusted, and that a browser extension is not blocking requests.", | ||||
|     "Sign in with single sign-on": "Sign in with single sign-on", | ||||
|     "Try the app first": "Try the app first", | ||||
|     "Sign in to get started": "Sign in to get started", | ||||
|     "Failed to fetch avatar URL": "Failed to fetch avatar URL", | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	 Richard van der Hoff
						Richard van der Hoff