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

Commit 5fe0798

Browse files
committed
Honour errors codes from submitToken as per MSC4183
1 parent 8b2ded8 commit 5fe0798

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

src/components/views/settings/AddRemoveThreepids.tsx

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,28 @@ const AddThreepidSection: React.FC<{ medium: "email" | "msisdn"; disabled?: bool
355355
: _t("settings|general|error_msisdn_verification"),
356356
description: _t("settings|general|email_verification_instructions"),
357357
});
358+
} else if (
359+
underlyingError instanceof MatrixError &&
360+
underlyingError.errcode === "M_SESSION_EXPIRED"
361+
) {
362+
Modal.createDialog(ErrorDialog, {
363+
title: _t("settings|general|error_3pid_session_expired"),
364+
description: _t("settings|general|session_expired_instructions"),
365+
});
366+
} else if (
367+
underlyingError instanceof MatrixError &&
368+
underlyingError.errcode === "M_TOKEN_INCORRECT"
369+
) {
370+
Modal.createDialog(ErrorDialog, {
371+
title:
372+
medium === "email"
373+
? _t("settings|general|token_incorrect_header")
374+
: _t("settings|general|token_incorrect_header"),
375+
description:
376+
medium === "msisdn"
377+
? _t("settings|general|msisdn_token_incorrect_body")
378+
: _t("invite|failed_generic"),
379+
});
358380
} else {
359381
Modal.createDialog(ErrorDialog, {
360382
title:

src/i18n/strings/en_EN.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2526,6 +2526,7 @@
25262526
"email_not_verified": "Your email address hasn't been verified yet",
25272527
"email_verification_instructions": "Click the link in the email you received to verify and then click continue again.",
25282528
"emails_heading": "Email addresses",
2529+
"error_3pid_session_expired": "Token Expired",
25292530
"error_add_email": "Unable to add email address",
25302531
"error_deactivate_communication": "There was a problem communicating with the server. Please try again.",
25312532
"error_deactivate_invalid_auth": "Server did not return valid authentication information.",
@@ -2548,6 +2549,7 @@
25482549
"language_section": "Language",
25492550
"msisdn_in_use": "This phone number is already in use",
25502551
"msisdn_label": "Phone Number",
2552+
"msisdn_token_incorrect_body": "The token you entered does not match.",
25512553
"msisdn_verification_field_label": "Verification code",
25522554
"msisdn_verification_instructions": "Please enter verification code sent via text.",
25532555
"msisdns_heading": "Phone numbers",
@@ -2560,7 +2562,9 @@
25602562
"profile_subtitle_oidc": "Your account is managed separately by an identity provider and so some of your personal information can’t be changed here.",
25612563
"remove_email_prompt": "Remove %(email)s?",
25622564
"remove_msisdn_prompt": "Remove %(phone)s?",
2565+
"session_expired_instructions": "This token has expired: request a new token to continue.",
25632566
"spell_check_locale_placeholder": "Choose a locale",
2567+
"token_incorrect_header": "Token incorrect",
25642568
"unable_to_load_emails": "Unable to load email addresses",
25652569
"unable_to_load_msisdns": "Unable to load phone numbers",
25662570
"username": "Username"

0 commit comments

Comments
 (0)