Add an optional config option to make the welcome page the login page

This is commonly requested by deployments with custom setups or those using SSO. Instead of having them all ship the same welcome.html with redirect code in it, we can offer a built-in redirect.

Note that this doesn't actually redirect and instead just replaces the view. This is to make the change less invasive as otherwise it involves changing the routing layers.
This commit is contained in:
Travis Ralston 2021-02-16 15:17:51 -07:00
parent b386f0c73b
commit 21b9ab9d85
2 changed files with 15 additions and 8 deletions

View file

@ -82,6 +82,7 @@ import {UIFeature} from "../../settings/UIFeature";
import { CommunityPrototypeStore } from "../../stores/CommunityPrototypeStore";
import DialPadModal from "../views/voip/DialPadModal";
import { showToast as showMobileGuideToast } from '../../toasts/MobileGuideToast';
import { shouldUseLoginForWelcome } from "../../utils/pages";
/** constants for MatrixChat.state.view */
export enum Views {
@ -1988,7 +1989,7 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
</div>
);
}
} else if (this.state.view === Views.WELCOME) {
} else if (this.state.view === Views.WELCOME && !shouldUseLoginForWelcome(SdkConfig.get())) {
const Welcome = sdk.getComponent('auth.Welcome');
view = <Welcome />;
} else if (this.state.view === Views.REGISTER && SettingsStore.getValue(UIFeature.Registration)) {
@ -2020,7 +2021,8 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
{...this.getServerProperties()}
/>
);
} else if (this.state.view === Views.LOGIN) {
} else if (this.state.view === Views.LOGIN
|| (this.state.view === Views.WELCOME && shouldUseLoginForWelcome(SdkConfig.get()))) {
const showPasswordReset = SettingsStore.getValue(UIFeature.PasswordReset);
const Login = sdk.getComponent('structures.auth.Login');
view = (