Improve auth error messages
This commit is contained in:
parent
225d541487
commit
6a315e80b6
4 changed files with 7 additions and 5 deletions
|
@ -476,8 +476,8 @@ export default class LoginComponent extends React.PureComponent<IProps, IState>
|
||||||
errCode = "HTTP " + err.httpStatus;
|
errCode = "HTTP " + err.httpStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
let errorText: ReactNode = _t("Error: Problem communicating with the given homeserver.") +
|
let errorText: ReactNode = _t("There was a problem communicating with the homeserver, " +
|
||||||
(errCode ? " (" + errCode + ")" : "");
|
"please try again later.") + (errCode ? " (" + errCode + ")" : "");
|
||||||
|
|
||||||
if (err.cors === 'rejected') {
|
if (err.cors === 'rejected') {
|
||||||
if (window.location.protocol === 'https:' &&
|
if (window.location.protocol === 'https:' &&
|
||||||
|
|
|
@ -366,6 +366,8 @@ export default class Registration extends React.Component<IProps, IState> {
|
||||||
if (!msisdnAvailable) {
|
if (!msisdnAvailable) {
|
||||||
msg = _t('This server does not support authentication with a phone number.');
|
msg = _t('This server does not support authentication with a phone number.');
|
||||||
}
|
}
|
||||||
|
} else if (response.errcode === "M_USER_IN_USE") {
|
||||||
|
msg = _t("That username already exists, please try another.");
|
||||||
}
|
}
|
||||||
this.setState({
|
this.setState({
|
||||||
busy: false,
|
busy: false,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright 2015, 2016, 2017, 2019 New Vector Ltd.
|
Copyright 2015, 2016, 2017, 2019 The Matrix.org Foundation C.I.C.
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
|
@ -293,7 +293,7 @@ export default class PasswordLogin extends React.PureComponent<IProps, IState> {
|
||||||
}, {
|
}, {
|
||||||
key: "number",
|
key: "number",
|
||||||
test: ({ value }) => !value || PHONE_NUMBER_REGEX.test(value),
|
test: ({ value }) => !value || PHONE_NUMBER_REGEX.test(value),
|
||||||
invalid: () => _t("Doesn't look like a valid phone number"),
|
invalid: () => _t("That phone number doesn't look quite right, please check and try again"),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
|
@ -346,7 +346,7 @@ export default class RegistrationForm extends React.PureComponent<IProps, IState
|
||||||
{
|
{
|
||||||
key: "email",
|
key: "email",
|
||||||
test: ({ value }) => !value || phoneNumberLooksValid(value),
|
test: ({ value }) => !value || phoneNumberLooksValid(value),
|
||||||
invalid: () => _t("Doesn't look like a valid phone number"),
|
invalid: () => _t("That phone number doesn't look quite right, please check and try again"),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue