From 3842bce74dc25f242b0cf710efd6d5d6d61ec3f9 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Wed, 4 Mar 2020 11:41:16 -0700 Subject: [PATCH] Fix SSO for new approach --- src/components/structures/auth/Login.js | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/components/structures/auth/Login.js b/src/components/structures/auth/Login.js index cf80c99535..6cce8f4444 100644 --- a/src/components/structures/auth/Login.js +++ b/src/components/structures/auth/Login.js @@ -28,6 +28,7 @@ import AutoDiscoveryUtils, {ValidatedServerConfig} from "../../../utils/AutoDisc import classNames from "classnames"; import AuthPage from "../../views/auth/AuthPage"; import SSOButton from "../../views/elements/SSOButton"; +import PlatformPeg from '../../../PlatformPeg'; // For validating phone numbers without country codes const PHONE_NUMBER_REGEX = /^[0-9()\-\s]*$/; @@ -155,14 +156,6 @@ export default createReactClass({ return this._getCurrentFlowStep() === 'm.login.sso' || this._getCurrentFlowStep() === 'm.login.cas'; }, - _getSsoUrl: function(kind) { - if (kind === 'm.login.cas') { - return this._loginLogic.getSsoLoginUrl("cas"); - } else { - return this._loginLogic.getSsoLoginUrl("sso"); - } - }, - onPasswordLogin: async function(username, phoneCountry, phoneNumber, password) { if (!this.state.serverIsAlive) { this.setState({busy: true}); @@ -357,7 +350,8 @@ export default createReactClass({ // so intercept the click and instead pretend the user clicked 'Sign in with SSO'. ev.preventDefault(); ev.stopPropagation(); - window.location = this._getSsoUrl(this._getCurrentFlowStep()); + const ssoKind = this._getCurrentFlowStep() === 'm.login.sso' ? 'sso' : 'cas'; + PlatformPeg.get().startSingleSignOn(this._loginLogic.createTemporaryClient(), ssoKind); } else { // Don't intercept - just go through to the register page this.onRegisterClick(ev);