Merge branch 'forbidden-login' into 'develop'
actions/auth: ignore the backend error message, always display "wrong username/password" Closes #1028 See merge request soapbox-pub/soapbox-fe!1615
This commit is contained in:
commit
bb352a75d7
|
@ -214,14 +214,6 @@ export const logIn = (username: string, password: string) =>
|
||||||
if ((error.response?.data as any).error === 'mfa_required') {
|
if ((error.response?.data as any).error === 'mfa_required') {
|
||||||
// If MFA is required, throw the error and handle it in the component.
|
// If MFA is required, throw the error and handle it in the component.
|
||||||
throw error;
|
throw error;
|
||||||
} else if ((error.response?.data as any).error === 'invalid_grant') {
|
|
||||||
// Mastodon returns this user-unfriendly error as a catch-all
|
|
||||||
// for everything from "bad request" to "wrong password".
|
|
||||||
// Assume our code is correct and it's a wrong password.
|
|
||||||
dispatch(snackbar.error(messages.invalidCredentials));
|
|
||||||
} else if ((error.response?.data as any).error) {
|
|
||||||
// If the backend returns an error, display it.
|
|
||||||
dispatch(snackbar.error((error.response?.data as any).error));
|
|
||||||
} else {
|
} else {
|
||||||
// Return "wrong password" message.
|
// Return "wrong password" message.
|
||||||
dispatch(snackbar.error(messages.invalidCredentials));
|
dispatch(snackbar.error(messages.invalidCredentials));
|
||||||
|
|
Loading…
Reference in New Issue