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

Commit a9c27e2

Browse files
authored
Handle and i18n M_THREEPID_IN_USE during registration (#6986)
1 parent 9c78671 commit a9c27e2

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

src/components/structures/auth/Registration.tsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ export default class Registration extends React.Component<IProps, IState> {
272272

273273
private onUIAuthFinished = async (success: boolean, response: any) => {
274274
if (!success) {
275-
let msg = response.message || response.toString();
275+
let errorText = response.message || response.toString();
276276
// can we give a better error message?
277277
if (response.errcode === 'M_RESOURCE_LIMIT_EXCEEDED') {
278278
const errorTop = messageForResourceLimitError(
@@ -291,7 +291,7 @@ export default class Registration extends React.Component<IProps, IState> {
291291
'': _td("Please <a>contact your service administrator</a> to continue using this service."),
292292
},
293293
);
294-
msg = <div>
294+
errorText = <div>
295295
<p>{ errorTop }</p>
296296
<p>{ errorDetail }</p>
297297
</div>;
@@ -301,15 +301,18 @@ export default class Registration extends React.Component<IProps, IState> {
301301
msisdnAvailable = msisdnAvailable || flow.stages.includes('m.login.msisdn');
302302
}
303303
if (!msisdnAvailable) {
304-
msg = _t('This server does not support authentication with a phone number.');
304+
errorText = _t('This server does not support authentication with a phone number.');
305305
}
306306
} else if (response.errcode === "M_USER_IN_USE") {
307-
msg = _t("That username already exists, please try another.");
307+
errorText = _t("That username already exists, please try another.");
308+
} else if (response.errcode === "M_THREEPID_IN_USE") {
309+
errorText = _t("That e-mail address is already in use.");
308310
}
311+
309312
this.setState({
310313
busy: false,
311314
doingUIAuth: false,
312-
errorText: msg,
315+
errorText,
313316
});
314317
return;
315318
}

src/i18n/strings/en_EN.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3056,6 +3056,7 @@
30563056
"Registration has been disabled on this homeserver.": "Registration has been disabled on this homeserver.",
30573057
"This server does not support authentication with a phone number.": "This server does not support authentication with a phone number.",
30583058
"That username already exists, please try another.": "That username already exists, please try another.",
3059+
"That e-mail address is already in use.": "That e-mail address is already in use.",
30593060
"Continue with %(ssoButtons)s": "Continue with %(ssoButtons)s",
30603061
"%(ssoButtons)s Or %(usernamePassword)s": "%(ssoButtons)s Or %(usernamePassword)s",
30613062
"Already have an account? <a>Sign in here</a>": "Already have an account? <a>Sign in here</a>",

0 commit comments

Comments
 (0)