You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-10 09:22:25 +03:00
Show modal on "instant SSO"
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
@@ -22,6 +22,11 @@ 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
|
||||
@@ -183,9 +188,21 @@ 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") {
|
||||
startSingleSignOn(mxClient: MatrixClient, loginType: "sso"|"cas", showModal: boolean) {
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user