Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Honour errors codes from submitToken as per MSC4183 #12936

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions src/components/views/settings/AddRemoveThreepids.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 4 additions & 0 deletions src/i18n/strings/en_EN.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand All @@ -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",
Expand All @@ -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"
Expand Down
Loading