mirror of https://github.com/vector-im/riot-web
revert stale changes
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>pull/21833/head
parent
db6f88c66a
commit
f4d3cc8ee6
|
@ -22,11 +22,6 @@ limitations under the License.
|
|||
import {MatrixClient} from "matrix-js-sdk";
|
||||
import dis from './dispatcher';
|
||||
import BaseEventIndexManager from './indexing/BaseEventIndexManager';
|
||||
import Modal from "./Modal";
|
||||
import InfoDialog from "./components/views/dialogs/InfoDialog";
|
||||
import {_t} from "./languageHandler";
|
||||
import Spinner from "./components/views/elements/Spinner";
|
||||
import React from "react";
|
||||
|
||||
/**
|
||||
* Base class for classes that provide platform-specific functionality
|
||||
|
@ -188,21 +183,9 @@ export default class BasePlatform {
|
|||
* Begin Single Sign On flows.
|
||||
* @param {MatrixClient} mxClient the matrix client using which we should start the flow
|
||||
* @param {"sso"|"cas"} loginType the type of SSO it is, CAS/SSO.
|
||||
* @param {boolean} showModal whether or not to show the spinner modal.
|
||||
*/
|
||||
startSingleSignOn(mxClient: MatrixClient, loginType: "sso"|"cas", showModal: boolean) {
|
||||
startSingleSignOn(mxClient: MatrixClient, loginType: "sso"|"cas") {
|
||||
const callbackUrl = this.getSSOCallbackUrl(mxClient.getHomeserverUrl(), mxClient.getIdentityServerUrl());
|
||||
if (showModal) {
|
||||
Modal.createTrackedDialog('BasePlatform', 'SSO', InfoDialog, {
|
||||
title: _t("Single sign-on"),
|
||||
description: <div>
|
||||
<Spinner />
|
||||
<a href={callbackUrl} rel="noreferrer noopener">
|
||||
{_t("Click here if you're not redirected automatically")}
|
||||
</a>
|
||||
</div>,
|
||||
});
|
||||
}
|
||||
window.location.href = mxClient.getSsoLoginUrl(callbackUrl.toString(), loginType); // redirect to SSO
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,10 +53,6 @@ _td("Invalid base_url for m.identity_server");
|
|||
_td("Identity server URL does not appear to be a valid identity server");
|
||||
_td("General failure");
|
||||
|
||||
const M_LOGIN_CAS = "m.login.cas";
|
||||
const M_LOGIN_SSO = "m.login.sso";
|
||||
const SSO_FLOWS = [M_LOGIN_SSO, M_LOGIN_CAS];
|
||||
|
||||
/**
|
||||
* A wire component which glues together login UI components and Login logic
|
||||
*/
|
||||
|
@ -126,11 +122,11 @@ export default createReactClass({
|
|||
'm.login.password': this._renderPasswordStep,
|
||||
|
||||
// CAS and SSO are the same thing, modulo the url we link to
|
||||
[M_LOGIN_CAS]: () => this._renderSsoStep("cas"),
|
||||
[M_LOGIN_SSO]: () => this._renderSsoStep("sso"),
|
||||
'm.login.cas': () => this._renderSsoStep("cas"),
|
||||
'm.login.sso': () => this._renderSsoStep("sso"),
|
||||
};
|
||||
|
||||
this._initLoginLogic(true);
|
||||
this._initLoginLogic();
|
||||
},
|
||||
|
||||
componentWillUnmount: function() {
|
||||
|
@ -142,7 +138,7 @@ export default createReactClass({
|
|||
newProps.serverConfig.isUrl === this.props.serverConfig.isUrl) return;
|
||||
|
||||
// Ensure that we end up actually logging in to the right place
|
||||
this._initLoginLogic(false, newProps.serverConfig.hsUrl, newProps.serverConfig.isUrl);
|
||||
this._initLoginLogic(newProps.serverConfig.hsUrl, newProps.serverConfig.isUrl);
|
||||
},
|
||||
|
||||
onPasswordLoginError: function(errorText) {
|
||||
|
@ -346,12 +342,12 @@ export default createReactClass({
|
|||
|
||||
onTryRegisterClick: function(ev) {
|
||||
const step = this._getCurrentFlowStep();
|
||||
if (SSO_FLOWS.includes(step)) {
|
||||
if (step === 'm.login.sso' || step === 'm.login.cas') {
|
||||
// If we're showing SSO it means that registration is also probably disabled,
|
||||
// so intercept the click and instead pretend the user clicked 'Sign in with SSO'.
|
||||
ev.preventDefault();
|
||||
ev.stopPropagation();
|
||||
const ssoKind = step === M_LOGIN_SSO ? 'sso' : 'cas';
|
||||
const ssoKind = step === 'm.login.sso' ? 'sso' : 'cas';
|
||||
PlatformPeg.get().startSingleSignOn(this._loginLogic.createTemporaryClient(), ssoKind);
|
||||
} else {
|
||||
// Don't intercept - just go through to the register page
|
||||
|
@ -373,7 +369,7 @@ export default createReactClass({
|
|||
});
|
||||
},
|
||||
|
||||
_initLoginLogic: async function(initial, hsUrl, isUrl) {
|
||||
_initLoginLogic: async function(hsUrl, isUrl) {
|
||||
hsUrl = hsUrl || this.props.serverConfig.hsUrl;
|
||||
isUrl = isUrl || this.props.serverConfig.isUrl;
|
||||
|
||||
|
@ -433,14 +429,6 @@ export default createReactClass({
|
|||
continue;
|
||||
}
|
||||
|
||||
// if this is the initial render and the flow we choose is SSO/CAS then go to it automatically
|
||||
// we do not do this when the user has changed to the server manually as that may be jarring.
|
||||
// Only allow it when disable_custom_urls is asserted so that we don't prevent user from changing HS URL
|
||||
if (initial && SdkConfig.get()['disable_custom_urls'] && SSO_FLOWS.includes(flows[i].type)) {
|
||||
const tmpCli = this._loginLogic.createTemporaryClient();
|
||||
PlatformPeg.get().startSingleSignOn(tmpCli, flows[i].type === M_LOGIN_SSO ? "sso": "cas", true);
|
||||
}
|
||||
|
||||
// we just pick the first flow where we support all the
|
||||
// steps. (we don't have a UI for multiple logins so let's skip
|
||||
// that for now).
|
||||
|
|
|
@ -19,6 +19,10 @@ import * as sdk from '../../../index';
|
|||
import SdkConfig from '../../../SdkConfig';
|
||||
import AuthPage from "./AuthPage";
|
||||
import * as Matrix from "matrix-js-sdk";
|
||||
import {_td} from "../../../languageHandler";
|
||||
|
||||
// translatable strings for Welcome pages
|
||||
_td("Sign in with SSO");
|
||||
|
||||
export default class Welcome extends React.PureComponent {
|
||||
render() {
|
||||
|
|
Loading…
Reference in New Issue