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

Commit

Permalink
Honour errors codes from submitToken as per MSC4183
Browse files Browse the repository at this point in the history
  • Loading branch information
dbkr committed Aug 29, 2024
1 parent 8b2ded8 commit 5fe0798
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
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

0 comments on commit 5fe0798

Please sign in to comment.