diff --git a/src/components/views/settings/AddRemoveThreepids.tsx b/src/components/views/settings/AddRemoveThreepids.tsx index 242afd272c0..236735e223e 100644 --- a/src/components/views/settings/AddRemoveThreepids.tsx +++ b/src/components/views/settings/AddRemoveThreepids.tsx @@ -355,6 +355,28 @@ const AddThreepidSection: React.FC<{ medium: "email" | "msisdn"; disabled?: bool : _t("settings|general|error_msisdn_verification"), description: _t("settings|general|email_verification_instructions"), }); + } else if ( + underlyingError instanceof MatrixError && + underlyingError.errcode === "M_SESSION_EXPIRED" + ) { + Modal.createDialog(ErrorDialog, { + title: _t("settings|general|error_3pid_session_expired"), + description: _t("settings|general|session_expired_instructions"), + }); + } else if ( + underlyingError instanceof MatrixError && + underlyingError.errcode === "M_TOKEN_INCORRECT" + ) { + Modal.createDialog(ErrorDialog, { + title: + medium === "email" + ? _t("settings|general|token_incorrect_header") + : _t("settings|general|token_incorrect_header"), + description: + medium === "msisdn" + ? _t("settings|general|msisdn_token_incorrect_body") + : _t("invite|failed_generic"), + }); } else { Modal.createDialog(ErrorDialog, { title: diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 889fc157e9e..5d930bab7a0 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -2526,6 +2526,7 @@ "email_not_verified": "Your email address hasn't been verified yet", "email_verification_instructions": "Click the link in the email you received to verify and then click continue again.", "emails_heading": "Email addresses", + "error_3pid_session_expired": "Token Expired", "error_add_email": "Unable to add email address", "error_deactivate_communication": "There was a problem communicating with the server. Please try again.", "error_deactivate_invalid_auth": "Server did not return valid authentication information.", @@ -2548,6 +2549,7 @@ "language_section": "Language", "msisdn_in_use": "This phone number is already in use", "msisdn_label": "Phone Number", + "msisdn_token_incorrect_body": "The token you entered does not match.", "msisdn_verification_field_label": "Verification code", "msisdn_verification_instructions": "Please enter verification code sent via text.", "msisdns_heading": "Phone numbers", @@ -2560,7 +2562,9 @@ "profile_subtitle_oidc": "Your account is managed separately by an identity provider and so some of your personal information can’t be changed here.", "remove_email_prompt": "Remove %(email)s?", "remove_msisdn_prompt": "Remove %(phone)s?", + "session_expired_instructions": "This token has expired: request a new token to continue.", "spell_check_locale_placeholder": "Choose a locale", + "token_incorrect_header": "Token incorrect", "unable_to_load_emails": "Unable to load email addresses", "unable_to_load_msisdns": "Unable to load phone numbers", "username": "Username"