Go to welcome on logout (#33306)
* Go to welcome on logout Instead of login, for QR login project * Update tests * Add tests * Delint * Update comments
This commit is contained in:
@@ -1133,7 +1133,7 @@ export async function onLoggedOut(): Promise<void> {
|
||||
// customisations got the memo.
|
||||
if (SdkConfig.get().logout_redirect_url) {
|
||||
logger.log("Redirecting to external provider to finish logout");
|
||||
// XXX: Defer this so that it doesn't race with MatrixChat unmounting the world by going to /#/login
|
||||
// XXX: Defer this so that it doesn't race with MatrixChat unmounting the world by going to /#/welcome
|
||||
window.setTimeout(() => {
|
||||
window.location.href = SdkConfig.get().logout_redirect_url!;
|
||||
}, 100);
|
||||
|
||||
@@ -25,15 +25,15 @@ Please see LICENSE files in the repository root for full details.
|
||||
* │ └───────────────────────────────────────────┐ │
|
||||
* │ │ No previous session │
|
||||
* │ ▼ │
|
||||
* │ (from all other states ┌─────────────────┐ │
|
||||
* │ except LOCK_STOLEN) │ WELCOME │ │
|
||||
* │ │ │ │ │
|
||||
* │ │ Client logged out └─────────────────┘ │
|
||||
* │ │ │ │ │
|
||||
* │ └──────────────────────────┐ "Sign in" │ │ "Create account" │
|
||||
* │ │ ┌────────────┘ └──────────────┐ │
|
||||
* │ │ │ │ │
|
||||
* │ "Forgot ▼ ▼ "Create an ▼ │
|
||||
* │ (from all other states Client logged out ┌─────────────────┐ │
|
||||
* │ except LOCK_STOLEN) ──────────────────────►│ WELCOME │ │
|
||||
* │ │ │ │
|
||||
* │ └─────────────────┘ │
|
||||
* │ │ │ │
|
||||
* │ "Sign in" │ │ "Create account" │
|
||||
* │ ┌────────────┘ └──────────────┐ │
|
||||
* │ │ │ │
|
||||
* │ "Forgot ▼ "Create an ▼ │
|
||||
* │ ┌─────────────────┐ password" ┌─────────────────┐ account" ┌─────────────────┐ │
|
||||
* │ │ FORGOT_PASSWORD │◄───────────────│ LOGIN │───────────────►│ REGISTER │ │
|
||||
* │ │ │───────────────►│ │◄───────────────│ │ │
|
||||
|
||||
@@ -422,7 +422,7 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
|
||||
this.onShowPostLoginScreen();
|
||||
}
|
||||
|
||||
const promisesList: Promise<any>[] = [this.firstSyncPromise.promise];
|
||||
const promisesList: Promise<unknown>[] = [this.firstSyncPromise.promise];
|
||||
let crossSigningIsSetUp = false;
|
||||
if (cryptoEnabled) {
|
||||
// check if the user has previously published public cross-signing keys,
|
||||
@@ -1101,17 +1101,18 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
|
||||
}
|
||||
}
|
||||
|
||||
private viewWelcome(): void {
|
||||
private viewWelcome(otherState?: Partial<IState>): void {
|
||||
if (shouldUseLoginForWelcome(SdkConfig.get())) {
|
||||
return this.viewLogin();
|
||||
return this.viewLogin(otherState);
|
||||
}
|
||||
this.setStateForNewView({
|
||||
view: Views.WELCOME,
|
||||
...otherState,
|
||||
});
|
||||
this.notifyNewScreen("welcome");
|
||||
}
|
||||
|
||||
private viewLogin(otherState?: any): void {
|
||||
private viewLogin(otherState?: Partial<IState>): void {
|
||||
this.setStateForNewView({
|
||||
view: Views.LOGIN,
|
||||
...otherState,
|
||||
@@ -1555,7 +1556,7 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
|
||||
* Called when the session is logged out
|
||||
*/
|
||||
private onLoggedOut(): void {
|
||||
this.viewLogin({
|
||||
this.viewWelcome({
|
||||
ready: false,
|
||||
collapseLhs: false,
|
||||
currentRoomId: null,
|
||||
|
||||
Reference in New Issue
Block a user