diff --git a/apps/web/src/Login.ts b/apps/web/src/Login.ts index 6a49e45845..8dd0fb601e 100644 --- a/apps/web/src/Login.ts +++ b/apps/web/src/Login.ts @@ -129,7 +129,7 @@ export default class Login { const tempClient = this.createTemporaryClient(); // we reuse the clientId from the oidcFlow for QR login // it might be that we later find that the homeserver is different and we initialise a new client - possibleQrFlow = await tryInitLoginWithQRFlow(tempClient,oidcFlow.clientId); + possibleQrFlow = await tryInitLoginWithQRFlow(tempClient, oidcFlow.clientId); } catch (e) { logger.warn("Could not fetch server versions for login with QR support, assuming unsupported", e); } @@ -317,7 +317,7 @@ const tryInitLoginWithQRFlow = async ( const flow = { type: "loginWithQrFlow", - clientId + clientId, } satisfies LoginWithQrFlow; return flow; diff --git a/apps/web/src/components/structures/auth/Login.tsx b/apps/web/src/components/structures/auth/Login.tsx index d2bdef7e18..2b385f4dfe 100644 --- a/apps/web/src/components/structures/auth/Login.tsx +++ b/apps/web/src/components/structures/auth/Login.tsx @@ -15,7 +15,7 @@ import { QrCodeIcon } from "@vector-im/compound-design-tokens/assets/web/icons"; import { secureRandomString } from "matrix-js-sdk/src/randomstring"; import { _t, UserFriendlyError } from "../../../languageHandler"; -import Login, { LoginWithQrFlow, type ClientLoginFlow, type OidcNativeFlow } from "../../../Login"; +import Login, { type LoginWithQrFlow, type ClientLoginFlow, type OidcNativeFlow } from "../../../Login"; import { messageForConnectionError, messageForLoginError } from "../../../utils/ErrorUtils"; import AutoDiscoveryUtils from "../../../utils/AutoDiscoveryUtils"; import AuthPage from "../../views/auth/AuthPage"; @@ -37,7 +37,6 @@ import { startOidcLogin } from "../../../utils/oidc/authorize"; import { ModuleApi } from "../../../modules/Api.ts"; import LoginWithQR from "../../views/auth/LoginWithQR.tsx"; import { Mode } from "../../views/auth/LoginWithQR-types.ts"; -import type LoginWithQRFlow from "../../views/auth/LoginWithQRFlow.tsx"; import createMatrixClient from "../../../utils/createMatrixClient.ts"; interface IProps { @@ -464,7 +463,7 @@ class LoginComponent extends React.PureComponent { ); }} > - {_t("action|continue")} + {_t("Sign in manually")} ); }; @@ -500,11 +499,10 @@ class LoginComponent extends React.PureComponent { private renderLoginWithQRStep = (): JSX.Element => { return ( <> -

or

- + ); }; diff --git a/apps/web/src/components/views/auth/LoginWithQR.tsx b/apps/web/src/components/views/auth/LoginWithQR.tsx index 99adaabae0..6327fcdd02 100644 --- a/apps/web/src/components/views/auth/LoginWithQR.tsx +++ b/apps/web/src/components/views/auth/LoginWithQR.tsx @@ -73,7 +73,9 @@ export default class LoginWithQR extends React.Component { } private get ourIntent(): RendezvousIntent { - return this.props.client.getUserId() ? RendezvousIntent.RECIPROCATE_LOGIN_ON_EXISTING_DEVICE : RendezvousIntent.LOGIN_ON_NEW_DEVICE; + return this.props.client.getUserId() + ? RendezvousIntent.RECIPROCATE_LOGIN_ON_EXISTING_DEVICE + : RendezvousIntent.LOGIN_ON_NEW_DEVICE; } public componentDidMount(): void { @@ -119,7 +121,10 @@ export default class LoginWithQR extends React.Component { if (msc4388) { // use helper methods for 2025 version - rendezvous = this.ourIntent === RendezvousIntent.LOGIN_ON_NEW_DEVICE ? await signInByGeneratingQR(this.props.client, this.onFailure) : await linkNewDeviceByGeneratingQR(this.props.client, this.onFailure); + rendezvous = + this.ourIntent === RendezvousIntent.LOGIN_ON_NEW_DEVICE + ? await signInByGeneratingQR(this.props.client, this.onFailure) + : await linkNewDeviceByGeneratingQR(this.props.client, this.onFailure); } else { // old way for 2024 version const transport = new MSC4108RendezvousSession({ @@ -161,7 +166,6 @@ export default class LoginWithQR extends React.Component { phase: Phase.OutOfBandConfirmation, homeserverBaseUrl: baseUrl, }); - } // we ask the user to confirm that the channel is secure @@ -210,10 +214,14 @@ export default class LoginWithQR extends React.Component { throw new Error("Homeserver base URL not found in state"); } - if (new URL(this.props.client.baseUrl).toString() !== new URL(this.state.homeserverBaseUrl).toString()) { + if ( + new URL(this.props.client.baseUrl).toString() !== new URL(this.state.homeserverBaseUrl).toString() + ) { // would need to switch homeservers this.setState({ phase: Phase.Error, failureReason: ClientRendezvousFailureReason.Unknown }); - logger.info(`Changing homeservers during new device login not yet supported: ${this.props.client.baseUrl} -> ${this.state.homeserverBaseUrl}`); + logger.info( + `Changing homeservers during new device login not yet supported: ${this.props.client.baseUrl} -> ${this.state.homeserverBaseUrl}`, + ); throw new Error("Changing homeservers during new device login not yet supported"); } @@ -239,7 +247,7 @@ export default class LoginWithQR extends React.Component { refreshToken: datr.refresh_token, homeserverUrl: this.state.homeserverBaseUrl, clientId: this.props.clientId, - idToken: datr.id_token ?? '', // I'm not sure the idToken is actually required + idToken: datr.id_token ?? "", // I'm not sure the idToken is actually required issuer: metadata!.issuer, identityServerUrl: undefined, // PROTOTYPE: we should have stored this from before });