Skip to content

Commit 73a2807

Browse files
committed
Wire up qr_login route
1 parent 3249b08 commit 73a2807

1 file changed

Lines changed: 25 additions & 2 deletions

File tree

apps/web/src/components/structures/MatrixChat.tsx

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,16 @@ import QrLogin from "./auth/QrLogin.tsx";
147147
// legacy export
148148
export { default as Views } from "../../Views";
149149

150-
const AUTH_SCREENS = ["register", "mobile_register", "login", "forgot_password", "start_sso", "start_cas", "welcome"];
150+
const AUTH_SCREENS = [
151+
"register",
152+
"mobile_register",
153+
"login",
154+
"qr_login",
155+
"forgot_password",
156+
"start_sso",
157+
"start_cas",
158+
"welcome",
159+
];
151160

152161
// Actions that are redirected through the onboarding process prior to being
153162
// re-dispatched. NOTE: some actions are non-trivial and would require
@@ -737,6 +746,12 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
737746
}
738747
this.viewLogin();
739748
break;
749+
case "start_qr_login":
750+
this.setStateForNewView({
751+
view: Views.QR_LOGIN,
752+
});
753+
this.notifyNewScreen("qr_login");
754+
break;
740755
case "start_password_recovery":
741756
this.setStateForNewView({
742757
view: Views.FORGOT_PASSWORD,
@@ -1858,6 +1873,12 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
18581873
params: params,
18591874
});
18601875
PerformanceMonitor.instance.start(PerformanceEntryNames.LOGIN);
1876+
} else if (screen === "qr_login") {
1877+
dis.dispatch({
1878+
action: "start_qr_login",
1879+
params: params,
1880+
});
1881+
PerformanceMonitor.instance.start(PerformanceEntryNames.LOGIN);
18611882
} else if (screen === "forgot_password") {
18621883
dis.dispatch({
18631884
action: "start_password_recovery",
@@ -2156,7 +2177,9 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
21562177
if (
21572178
initialScreenAfterLogin &&
21582179
// XXX: workaround for https://github.com/vector-im/element-web/issues/11643 causing a login-loop
2159-
!["welcome", "login", "register", "start_sso", "start_cas"].includes(initialScreenAfterLogin.screen)
2180+
!["welcome", "login", "qr_login", "register", "start_sso", "start_cas"].includes(
2181+
initialScreenAfterLogin.screen,
2182+
)
21602183
) {
21612184
fragmentAfterLogin = `/${initialScreenAfterLogin.screen}`;
21622185
}

0 commit comments

Comments
 (0)