Show modal on "instant SSO"
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
c41b39488b
commit
7fbfd73e11
2 changed files with 19 additions and 2 deletions
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -437,7 +437,7 @@ export default createReactClass({
|
|||
// we do not do this when the user has changed to the server manually as that may be jarring.
|
||||
if (initial && SSO_FLOWS.includes(flows[i].type)) {
|
||||
const tmpCli = this._loginLogic.createTemporaryClient();
|
||||
PlatformPeg.get().startSingleSignOn(tmpCli, flows[i].type === M_LOGIN_SSO ? "sso": "cas");
|
||||
PlatformPeg.get().startSingleSignOn(tmpCli, flows[i].type === M_LOGIN_SSO ? "sso": "cas", true);
|
||||
}
|
||||
|
||||
// we just pick the first flow where we support all the
|
||||
|
|
Loading…
Reference in a new issue