From 72429c1350e392e7801fc475b7371a60e0618620 Mon Sep 17 00:00:00 2001 From: Andy Balaam Date: Fri, 2 May 2025 10:20:22 +0100 Subject: [PATCH] Make OIDC identity reset consistent with EX (#29854) * Allow providing an empty title to InteractiveAuthDialog * Make OIDC identity reset consistent with EX * Translation changes for OIDC Identity reset (already added to Localazy) * Fix auth tests for new wording 'Continue to account' --- src/CreateCrossSigning.ts | 2 +- .../auth/InteractiveAuthEntryComponents.tsx | 23 +++++---- .../views/dialogs/InteractiveAuthDialog.tsx | 2 +- src/i18n/strings/en_EN.json | 5 +- .../InteractiveAuthEntryComponents-test.tsx | 2 +- ...teractiveAuthEntryComponents-test.tsx.snap | 47 +++++++++++++++---- 6 files changed, 58 insertions(+), 23 deletions(-) diff --git a/src/CreateCrossSigning.ts b/src/CreateCrossSigning.ts index db9bc3e3fe..c8e7aa3e73 100644 --- a/src/CreateCrossSigning.ts +++ b/src/CreateCrossSigning.ts @@ -64,7 +64,7 @@ export async function uiAuthCallback( }; const { finished } = Modal.createDialog(InteractiveAuthDialog, { - title: _t("encryption|bootstrap_title"), + title: "", matrixClient, makeRequest, aestheticsForStagePhases: { diff --git a/src/components/views/auth/InteractiveAuthEntryComponents.tsx b/src/components/views/auth/InteractiveAuthEntryComponents.tsx index 321cb15ec3..a9bf8b7597 100644 --- a/src/components/views/auth/InteractiveAuthEntryComponents.tsx +++ b/src/components/views/auth/InteractiveAuthEntryComponents.tsx @@ -11,8 +11,9 @@ import { type InternationalisedPolicy, type Terms, type MatrixClient } from "mat import { AuthType, type AuthDict, type IInputs, type IStageStatus } from "matrix-js-sdk/src/interactive-auth"; import { logger } from "matrix-js-sdk/src/logger"; import React, { type JSX, type ChangeEvent, createRef, type FormEvent, Fragment } from "react"; -import { Button, Text } from "@vector-im/compound-web"; +import { Button } from "@vector-im/compound-web"; import PopOutIcon from "@vector-im/compound-design-tokens/assets/web/icons/pop-out"; +import UserProfileSolidIcon from "@vector-im/compound-design-tokens/assets/web/icons/user-profile-solid"; import EmailPromptIcon from "../../../../res/img/element-icons/email-prompt.svg"; import { _t } from "../../../languageHandler"; @@ -21,8 +22,9 @@ import AccessibleButton, { type AccessibleButtonKind, type ButtonEvent } from ". import Field from "../elements/Field"; import Spinner from "../elements/Spinner"; import CaptchaForm from "./CaptchaForm"; -import { Flex } from "../../utils/Flex"; import { pickBestPolicyLanguage } from "../../../Terms.ts"; +import { EncryptionCardButtons } from "../settings/encryption/EncryptionCardButtons.tsx"; +import { EncryptionCard } from "../settings/encryption/EncryptionCard.tsx"; /* This file contains a collection of components which are used by the * InteractiveAuth to prompt the user to enter the information needed @@ -971,9 +973,14 @@ export class MasUnlockCrossSigningAuthEntry extends FallbackAuthEntry<{ public render(): React.ReactNode { return ( -
- {_t("auth|uia|mas_cross_signing_reset_description")} - + + - - -
+ + ); } } diff --git a/src/components/views/dialogs/InteractiveAuthDialog.tsx b/src/components/views/dialogs/InteractiveAuthDialog.tsx index 96abb35ea4..d4ea7218c7 100644 --- a/src/components/views/dialogs/InteractiveAuthDialog.tsx +++ b/src/components/views/dialogs/InteractiveAuthDialog.tsx @@ -136,7 +136,7 @@ export default class InteractiveAuthDialog extends React.Component our props > defaults. - let title = this.state.authError ? "Error" : this.props.title || _t("common|authentication"); + let title = this.state.authError ? "Error" : (this.props.title ?? _t("common|authentication")); let body = this.state.authError ? null : this.props.body; let continueText: string | undefined; let continueKind: ContinueKind | undefined; diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 54129a3f10..d86d1940d7 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -384,8 +384,9 @@ "email_resend_prompt": "Did not receive it? Resend it", "email_resent": "Resent!", "fallback_button": "Start authentication", - "mas_cross_signing_reset_cta": "Go to your account", - "mas_cross_signing_reset_description": "Reset your identity through your account provider and then come back and click “Retry”.", + "mas_cross_signing_reset_cta": "Continue to account", + "mas_cross_signing_reset_description": "You're about to go to your %(serverName)s account to reset your identity. Once you have completed reset on your account, please return here and click Retry.", + "mas_cross_signing_reset_title": "Go to your account to reset your identity", "msisdn": "A text message has been sent to %(msisdn)s", "msisdn_token_incorrect": "Token incorrect", "msisdn_token_prompt": "Please enter the code it contains:", diff --git a/test/unit-tests/components/views/auth/InteractiveAuthEntryComponents-test.tsx b/test/unit-tests/components/views/auth/InteractiveAuthEntryComponents-test.tsx index 4768eed4dc..485f8e077b 100644 --- a/test/unit-tests/components/views/auth/InteractiveAuthEntryComponents-test.tsx +++ b/test/unit-tests/components/views/auth/InteractiveAuthEntryComponents-test.tsx @@ -87,7 +87,7 @@ describe("", () => { const spy = jest.spyOn(global.window, "open"); renderAuth(); - fireEvent.click(screen.getByRole("button", { name: "Go to your account" })); + fireEvent.click(screen.getByRole("button", { name: "Continue to account" })); expect(spy).toHaveBeenCalledWith("https://example.com", "_blank"); }); diff --git a/test/unit-tests/components/views/auth/__snapshots__/InteractiveAuthEntryComponents-test.tsx.snap b/test/unit-tests/components/views/auth/__snapshots__/InteractiveAuthEntryComponents-test.tsx.snap index 50a16c316d..17f61abcbb 100644 --- a/test/unit-tests/components/views/auth/__snapshots__/InteractiveAuthEntryComponents-test.tsx.snap +++ b/test/unit-tests/components/views/auth/__snapshots__/InteractiveAuthEntryComponents-test.tsx.snap @@ -35,15 +35,42 @@ exports[` should render 1`] = ` exports[` should render 1`] = `
-
-

- Reset your identity through your account provider and then come back and click “Retry”. -

+
+
+ + + + +
+

+ Go to your account to reset your identity +

+ + You're about to go to your matrix.org account to reset your identity. Once you have completed reset on your account, please return here and click Retry. + +
+