X-Git-Url: http://these/git/?a=blobdiff_plain;f=src%2Fshared%2Fcomponents%2Fhome%2Flogin.tsx;h=828cbb5f8b51cfa66665e546f797c6b0802bce6d;hb=b7ec7ae3110c560968e0cb24a32f1fe9166eec29;hp=4dd6466577f0180f664f8a43078fe0e427a6a0a7;hpb=1ce6eb3284ea25fd5b1608b72a7dddcbe3eb30e3;p=lemmy-ui.git diff --git a/src/shared/components/home/login.tsx b/src/shared/components/home/login.tsx index 4dd6466..828cbb5 100644 --- a/src/shared/components/home/login.tsx +++ b/src/shared/components/home/login.tsx @@ -1,6 +1,5 @@ import { myAuth, setIsoData } from "@utils/app"; import { isBrowser } from "@utils/browser"; -import { validEmail } from "@utils/helpers"; import { Component, linkEvent } from "inferno"; import { GetSiteResponse, LoginResponse } from "lemmy-js-client"; import { I18NextService, UserService } from "../../services"; @@ -8,6 +7,7 @@ import { HttpService, RequestState } from "../../services/HttpService"; import { toast } from "../../toast"; import { HtmlTags } from "../common/html-tags"; import { Spinner } from "../common/icon"; +import PasswordInput from "../common/password-input"; interface State { loginRes: RequestState; @@ -69,7 +69,7 @@ export class Login extends Component { return (
-
{I18NextService.i18n.t("login")}
+

{I18NextService.i18n.t("login")}

-
- -
- - -
+
+
{this.state.showTotp && (
@@ -175,13 +155,18 @@ export class Login extends Component { i.setState({ showTotp: true }); toast(I18NextService.i18n.t("enter_two_factor_code"), "info"); } + if (loginRes.msg === "incorrect_login") { + toast(I18NextService.i18n.t("incorrect_login"), "danger"); + } i.setState({ loginRes: { state: "failed", msg: loginRes.msg } }); break; } case "success": { - UserService.Instance.login(loginRes.data); + UserService.Instance.login({ + res: loginRes.data, + }); const site = await HttpService.client.getSite({ auth: myAuth(), }); @@ -214,15 +199,4 @@ export class Login extends Component { i.state.form.password = event.target.value; i.setState(i.state); } - - async handlePasswordReset(i: Login, event: any) { - event.preventDefault(); - const email = i.state.form.username_or_email; - if (email) { - const res = await HttpService.client.passwordReset({ email }); - if (res.state == "success") { - toast(I18NextService.i18n.t("reset_password_mail_sent")); - } - } - } }