Redirect to login properly
This commit is contained in:
parent
c8d7b0e1b9
commit
75cfd9a8f5
1 changed files with 17 additions and 14 deletions
|
@ -604,12 +604,7 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
|
||||||
if (payload.screenAfterLogin) {
|
if (payload.screenAfterLogin) {
|
||||||
this.screenAfterLogin = payload.screenAfterLogin;
|
this.screenAfterLogin = payload.screenAfterLogin;
|
||||||
}
|
}
|
||||||
this.setStateForNewView({
|
this.viewLogin();
|
||||||
view: Views.LOGIN,
|
|
||||||
});
|
|
||||||
this.notifyNewScreen('login');
|
|
||||||
ThemeController.isLogin = true;
|
|
||||||
this.themeWatcher.recheck();
|
|
||||||
break;
|
break;
|
||||||
case 'start_password_recovery':
|
case 'start_password_recovery':
|
||||||
this.setStateForNewView({
|
this.setStateForNewView({
|
||||||
|
@ -973,6 +968,9 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
|
||||||
}
|
}
|
||||||
|
|
||||||
private viewWelcome() {
|
private viewWelcome() {
|
||||||
|
if (shouldUseLoginForWelcome(SdkConfig.get())) {
|
||||||
|
return this.viewLogin();
|
||||||
|
}
|
||||||
this.setStateForNewView({
|
this.setStateForNewView({
|
||||||
view: Views.WELCOME,
|
view: Views.WELCOME,
|
||||||
});
|
});
|
||||||
|
@ -981,6 +979,16 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
|
||||||
this.themeWatcher.recheck();
|
this.themeWatcher.recheck();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private viewLogin(otherState?: any) {
|
||||||
|
this.setStateForNewView({
|
||||||
|
view: Views.LOGIN,
|
||||||
|
...otherState,
|
||||||
|
});
|
||||||
|
this.notifyNewScreen('login');
|
||||||
|
ThemeController.isLogin = true;
|
||||||
|
this.themeWatcher.recheck();
|
||||||
|
}
|
||||||
|
|
||||||
private viewHome(justRegistered = false) {
|
private viewHome(justRegistered = false) {
|
||||||
// The home page requires the "logged in" view, so we'll set that.
|
// The home page requires the "logged in" view, so we'll set that.
|
||||||
this.setStateForNewView({
|
this.setStateForNewView({
|
||||||
|
@ -1296,17 +1304,13 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
|
||||||
* Called when the session is logged out
|
* Called when the session is logged out
|
||||||
*/
|
*/
|
||||||
private onLoggedOut() {
|
private onLoggedOut() {
|
||||||
this.notifyNewScreen('login');
|
this.viewLogin({
|
||||||
this.setStateForNewView({
|
|
||||||
view: Views.LOGIN,
|
|
||||||
ready: false,
|
ready: false,
|
||||||
collapseLhs: false,
|
collapseLhs: false,
|
||||||
currentRoomId: null,
|
currentRoomId: null,
|
||||||
});
|
});
|
||||||
this.subTitleStatus = '';
|
this.subTitleStatus = '';
|
||||||
this.setPageSubtitle();
|
this.setPageSubtitle();
|
||||||
ThemeController.isLogin = true;
|
|
||||||
this.themeWatcher.recheck();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2011,7 +2015,7 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else if (this.state.view === Views.WELCOME && !shouldUseLoginForWelcome(SdkConfig.get())) {
|
} else if (this.state.view === Views.WELCOME) {
|
||||||
const Welcome = sdk.getComponent('auth.Welcome');
|
const Welcome = sdk.getComponent('auth.Welcome');
|
||||||
view = <Welcome />;
|
view = <Welcome />;
|
||||||
} else if (this.state.view === Views.REGISTER && SettingsStore.getValue(UIFeature.Registration)) {
|
} else if (this.state.view === Views.REGISTER && SettingsStore.getValue(UIFeature.Registration)) {
|
||||||
|
@ -2043,8 +2047,7 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
|
||||||
{...this.getServerProperties()}
|
{...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 showPasswordReset = SettingsStore.getValue(UIFeature.PasswordReset);
|
||||||
const Login = sdk.getComponent('structures.auth.Login');
|
const Login = sdk.getComponent('structures.auth.Login');
|
||||||
view = (
|
view = (
|
||||||
|
|
Loading…
Reference in a new issue