Commit ad85a3d5 authored by Eric Rosenbaum's avatar Eric Rosenbaum

handle password error

parent ffe14754
...@@ -10,6 +10,7 @@ const Errors = keyMirror({ ...@@ -10,6 +10,7 @@ const Errors = keyMirror({
NETWORK: null, NETWORK: null,
SERVER: null, SERVER: null,
PERMISSION: null, PERMISSION: null,
PASSWORD: null,
DUPLICATE: null, DUPLICATE: null,
USER_MUTED: null, USER_MUTED: null,
UNKNOWN_USERNAME: null, UNKNOWN_USERNAME: null,
...@@ -27,6 +28,9 @@ const normalizeError = (err, body, res) => { ...@@ -27,6 +28,9 @@ const normalizeError = (err, body, res) => {
return Errors.MANAGER_LIMIT; return Errors.MANAGER_LIMIT;
} }
if (res.statusCode === 403 && body.mute_status) return Errors.USER_MUTED; 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 === 401 || res.statusCode === 403) return Errors.PERMISSION;
if (res.statusCode === 404) return Errors.UNKNOWN_USERNAME; if (res.statusCode === 404) return Errors.UNKNOWN_USERNAME;
if (res.statusCode === 409) return Errors.CANNOT_BE_HOST; if (res.statusCode === 409) return Errors.CANNOT_BE_HOST;
......
...@@ -57,7 +57,7 @@ const TransferHostConfirmation = ({ ...@@ -57,7 +57,7 @@ const TransferHostConfirmation = ({
}) })
.catch(e => { .catch(e => {
// For password errors, show validation alert without closing the modal // For password errors, show validation alert without closing the modal
if (e === Errors.PERMISSION) { if (e === Errors.PASSWORD) {
setSubmitting(false); setSubmitting(false);
setValidationError(e); setValidationError(e);
return; 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