mirror of
https://github.com/vector-im/element-web.git
synced 2026-03-28 16:51:04 +01:00
Delint and example button labels to match EX
This commit is contained in:
parent
ef1c1d5009
commit
595eb1383f
@ -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;
|
||||
|
||||
@ -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<IProps, IState> {
|
||||
);
|
||||
}}
|
||||
>
|
||||
{_t("action|continue")}
|
||||
{_t("Sign in manually")}
|
||||
</Button>
|
||||
);
|
||||
};
|
||||
@ -500,11 +499,10 @@ class LoginComponent extends React.PureComponent<IProps, IState> {
|
||||
private renderLoginWithQRStep = (): JSX.Element => {
|
||||
return (
|
||||
<>
|
||||
<p className="mx_Login_withQR_or">or</p>
|
||||
<AccessibleButton className="mx_Login_withQR" kind="primary_outline" onClick={this.startLoginWithQR}>
|
||||
<Button className="mx_Login_fullWidthButton" kind="primary" size="sm" onClick={this.startLoginWithQR}>
|
||||
<QrCodeIcon />
|
||||
{_t("Sign in with QR code")}
|
||||
</AccessibleButton>
|
||||
</Button>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
@ -73,7 +73,9 @@ export default class LoginWithQR extends React.Component<IProps, IState> {
|
||||
}
|
||||
|
||||
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<IProps, IState> {
|
||||
|
||||
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<IProps, IState> {
|
||||
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<IProps, IState> {
|
||||
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<IProps, IState> {
|
||||
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
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user