You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-13 08:02:38 +03:00
Move all login error string generation into view
This makes all the various hits done by login report the same useful error messages and gets rid of the broken ones like printing the http status code even if it was undefined. Also add text for the case of overzealous browser extensions because lots of people get bitten by it.
This commit is contained in:
18
src/Login.js
18
src/Login.js
@@ -97,11 +97,6 @@ export default class Login {
|
||||
guest: true
|
||||
};
|
||||
}, (error) => {
|
||||
if (error.httpStatus === 403) {
|
||||
error.friendlyText = _t("Guest access is disabled on this Home Server.");
|
||||
} else {
|
||||
error.friendlyText = _t("Failed to register as guest:") + ' ' + error.data;
|
||||
}
|
||||
throw error;
|
||||
});
|
||||
}
|
||||
@@ -157,14 +152,7 @@ export default class Login {
|
||||
accessToken: data.access_token
|
||||
});
|
||||
}, function(error) {
|
||||
if (error.httpStatus == 400 && loginParams.medium) {
|
||||
error.friendlyText = (
|
||||
_t('This Home Server does not support login using email address.')
|
||||
);
|
||||
} else if (error.httpStatus === 403) {
|
||||
error.friendlyText = (
|
||||
_t('Incorrect username and/or password.')
|
||||
);
|
||||
if (error.httpStatus === 403) {
|
||||
if (self._fallbackHsUrl) {
|
||||
var fbClient = Matrix.createClient({
|
||||
baseUrl: self._fallbackHsUrl,
|
||||
@@ -184,10 +172,6 @@ export default class Login {
|
||||
throw error;
|
||||
});
|
||||
}
|
||||
} else {
|
||||
error.friendlyText = (
|
||||
_t("There was a problem logging in.") + ' (HTTP ' + error.httpStatus + ")"
|
||||
);
|
||||
}
|
||||
throw error;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user