handle login failures correctly
This commit is contained in:
parent
55512a2eae
commit
93e3598328
1 changed files with 29 additions and 33 deletions
|
@ -160,7 +160,6 @@ export class Login extends Component<any, State> {
|
||||||
if (username_or_email && password) {
|
if (username_or_email && password) {
|
||||||
i.setState({ loginRes: { state: "loading" } });
|
i.setState({ loginRes: { state: "loading" } });
|
||||||
|
|
||||||
try {
|
|
||||||
const loginRes = await HttpService.client.login({
|
const loginRes = await HttpService.client.login({
|
||||||
username_or_email,
|
username_or_email,
|
||||||
password,
|
password,
|
||||||
|
@ -173,7 +172,7 @@ export class Login extends Component<any, State> {
|
||||||
toast(i18n.t("enter_two_factor_code"), "info");
|
toast(i18n.t("enter_two_factor_code"), "info");
|
||||||
}
|
}
|
||||||
|
|
||||||
i.setState({ loginRes: { state: "empty" } });
|
i.setState({ loginRes: { state: "failed", msg: loginRes.msg } });
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -194,9 +193,6 @@ export class Login extends Component<any, State> {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (error) {
|
|
||||||
i.setState({ loginRes: { state: "failed", msg: error.message } });
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue