X-Git-Url: http://these/git/?a=blobdiff_plain;f=src%2Fshared%2Fcomponents%2Fhome%2Fsignup.tsx;h=c57d545aa8b368045ab495baf3b7e5e52b61bfaf;hb=b7ec7ae3110c560968e0cb24a32f1fe9166eec29;hp=7d504184f7fd2d5e9d366a295c5b55330c0813e8;hpb=a7d91d3f2cd335ec0f805b6689439636ad27a39c;p=lemmy-ui.git diff --git a/src/shared/components/home/signup.tsx b/src/shared/components/home/signup.tsx index 7d50418..c57d545 100644 --- a/src/shared/components/home/signup.tsx +++ b/src/shared/components/home/signup.tsx @@ -1,6 +1,6 @@ +import { myAuth, setIsoData } from "@utils/app"; import { isBrowser } from "@utils/browser"; -import { Options, passwordStrength } from "check-password-strength"; -import { NoOptionI18nKeys } from "i18next"; +import { validEmail } from "@utils/helpers"; import { Component, linkEvent } from "inferno"; import { T } from "inferno-i18next-dess"; import { @@ -10,47 +10,15 @@ import { LoginResponse, SiteView, } from "lemmy-js-client"; -import { i18n } from "../../i18next"; -import { UserService } from "../../services"; +import { joinLemmyUrl } from "../../config"; +import { mdToHtml } from "../../markdown"; +import { I18NextService, UserService } from "../../services"; import { HttpService, RequestState } from "../../services/HttpService"; -import { - joinLemmyUrl, - mdToHtml, - myAuth, - setIsoData, - toast, - validEmail, -} from "../../utils"; +import { toast } from "../../toast"; import { HtmlTags } from "../common/html-tags"; import { Icon, Spinner } from "../common/icon"; import { MarkdownTextArea } from "../common/markdown-textarea"; - -const passwordStrengthOptions: Options = [ - { - id: 0, - value: "very_weak", - minDiversity: 0, - minLength: 0, - }, - { - id: 1, - value: "weak", - minDiversity: 2, - minLength: 10, - }, - { - id: 2, - value: "medium", - minDiversity: 3, - minLength: 12, - }, - { - id: 3, - value: "strong", - minDiversity: 4, - minLength: 14, - }, -]; +import PasswordInput from "../common/password-input"; interface State { registerRes: RequestState; @@ -116,7 +84,7 @@ export class Signup extends Component { } titleName(siteView: SiteView): string { - return i18n.t( + return I18NextService.i18n.t( siteView.local_site.private_instance ? "apply_to_join" : "sign_up" ); } @@ -144,8 +112,11 @@ export class Signup extends Component { registerForm() { const siteView = this.state.siteRes.site_view; return ( -
-
{this.titleName(siteView)}
+ +

{this.titleName(siteView)}

{this.isLemmyMl && (
@@ -162,7 +133,7 @@ export class Signup extends Component { className="col-sm-2 col-form-label" htmlFor="register-username" > - {i18n.t("username")} + {I18NextService.i18n.t("username")}
@@ -175,14 +146,14 @@ export class Signup extends Component { required minLength={3} pattern="[a-zA-Z0-9_]+" - title={i18n.t("community_reqs")} + title={I18NextService.i18n.t("community_reqs")} />
{ className="form-control" placeholder={ siteView.local_site.require_email_verification - ? i18n.t("required") - : i18n.t("optional") + ? I18NextService.i18n.t("required") + : I18NextService.i18n.t("optional") } value={this.state.form.email} autoComplete="email" @@ -205,67 +176,38 @@ export class Signup extends Component { !validEmail(this.state.form.email) && (
- {i18n.t("no_password_reset")} + {I18NextService.i18n.t("no_password_reset")}
)}
-
- -
- - {this.state.form.password && ( -
- {i18n.t(this.passwordStrength as NoOptionI18nKeys)} -
- )} -
+
+
-
- -
- -
+
+
- {siteView.local_site.registration_mode == "RequireApplication" && ( + {siteView.local_site.registration_mode === "RequireApplication" && ( <>
- {i18n.t("fill_out_application")} + {I18NextService.i18n.t("fill_out_application")}
{siteView.local_site.application_question && (
{ className="col-sm-2 col-form-label" htmlFor="application_answer" > - {i18n.t("answer")} + {I18NextService.i18n.t("answer")}
{ onChange={linkEvent(this, this.handleRegisterShowNsfwChange)} />
@@ -348,12 +290,14 @@ export class Signup extends Component { return (