2019-02-07 19:25:09 +03:00
|
|
|
/*
|
|
|
|
Copyright 2019 New Vector 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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
import React from 'react';
|
2019-12-20 04:19:56 +03:00
|
|
|
import * as sdk from '../../../index';
|
2019-02-07 19:25:09 +03:00
|
|
|
import SdkConfig from '../../../SdkConfig';
|
2019-12-13 05:31:52 +03:00
|
|
|
import AuthPage from "./AuthPage";
|
2020-03-27 17:02:32 +03:00
|
|
|
import * as Matrix from "matrix-js-sdk";
|
2019-02-07 19:25:09 +03:00
|
|
|
|
|
|
|
export default class Welcome extends React.PureComponent {
|
|
|
|
render() {
|
|
|
|
const EmbeddedPage = sdk.getComponent('structures.EmbeddedPage');
|
2019-02-08 14:39:30 +03:00
|
|
|
const LanguageSelector = sdk.getComponent('auth.LanguageSelector');
|
2019-02-07 19:25:09 +03:00
|
|
|
|
2019-02-08 16:55:23 +03:00
|
|
|
const pagesConfig = SdkConfig.get().embeddedPages;
|
2019-02-08 16:53:17 +03:00
|
|
|
let pageUrl = null;
|
|
|
|
if (pagesConfig) {
|
|
|
|
pageUrl = pagesConfig.welcomeUrl;
|
|
|
|
}
|
|
|
|
if (!pageUrl) {
|
|
|
|
pageUrl = 'welcome.html';
|
|
|
|
}
|
2019-02-07 20:16:02 +03:00
|
|
|
|
2020-03-27 17:02:32 +03:00
|
|
|
const {hsUrl, isUrl} = this.props.serverConfig;
|
|
|
|
const tmpClient = Matrix.createClient({
|
|
|
|
baseUrl: hsUrl,
|
|
|
|
idBaseUrl: isUrl,
|
|
|
|
});
|
|
|
|
const callbackUrl = this.getSSOCallbackUrl(tmpClient.getHomeserverUrl(), tmpClient.getIdentityServerUrl());
|
|
|
|
|
2019-02-07 19:25:09 +03:00
|
|
|
return (
|
|
|
|
<AuthPage>
|
2019-02-08 14:39:30 +03:00
|
|
|
<div className="mx_Welcome">
|
2020-03-27 17:02:32 +03:00
|
|
|
<EmbeddedPage
|
|
|
|
className="mx_WelcomePage"
|
2019-02-08 14:39:30 +03:00
|
|
|
url={pageUrl}
|
2020-03-27 17:02:32 +03:00
|
|
|
replaceMap={{
|
|
|
|
"$ssoUrl": tmpClient.getSsoLoginUrl(callbackUrl.toString(), "sso"),
|
|
|
|
"$casUrl": tmpClient.getSsoLoginUrl(callbackUrl.toString(), "cas"),
|
|
|
|
}}
|
2019-02-08 14:39:30 +03:00
|
|
|
/>
|
|
|
|
<LanguageSelector />
|
|
|
|
</div>
|
2019-02-07 19:25:09 +03:00
|
|
|
</AuthPage>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|