Commit ad85a3d5 authored by Eric Rosenbaum's avatar Eric Rosenbaum

handle password error

parent ffe14754
......@@ -10,6 +10,7 @@ const Errors = keyMirror({
NETWORK: null,
SERVER: null,
PERMISSION: null,
PASSWORD: null,
DUPLICATE: null,
USER_MUTED: null,
UNKNOWN_USERNAME: null,
......@@ -27,6 +28,9 @@ const normalizeError = (err, body, res) => {
return Errors.MANAGER_LIMIT;
}
if (res.statusCode === 403 && body.mute_status) return Errors.USER_MUTED;
if (res.statusCode === 401 && body.message === 'password incorrect') {
return Errors.PASSWORD;
}
if (res.statusCode === 401 || res.statusCode === 403) return Errors.PERMISSION;
if (res.statusCode === 404) return Errors.UNKNOWN_USERNAME;
if (res.statusCode === 409) return Errors.CANNOT_BE_HOST;
......
......@@ -57,7 +57,7 @@ const TransferHostConfirmation = ({
})
.catch(e => {
// For password errors, show validation alert without closing the modal
if (e === Errors.PERMISSION) {
if (e === Errors.PASSWORD) {
setSubmitting(false);
setValidationError(e);
return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment