X-Git-Url: http://these/git/?a=blobdiff_plain;f=src%2Fshared%2Fcomponents%2Fhome%2Fsignup.tsx;h=c57d545aa8b368045ab495baf3b7e5e52b61bfaf;hb=b7ec7ae3110c560968e0cb24a32f1fe9166eec29;hp=16a3cc6d3eef61dbb4624a6acdefaf90429b3009;hpb=31e61e7449a0aef46b7d9ccd0ecff3304e3614f5;p=lemmy-ui.git diff --git a/src/shared/components/home/signup.tsx b/src/shared/components/home/signup.tsx index 16a3cc6..c57d545 100644 --- a/src/shared/components/home/signup.tsx +++ b/src/shared/components/home/signup.tsx @@ -1,5 +1,6 @@ -import { Options, passwordStrength } from "check-password-strength"; -import { NoOptionI18nKeys } from "i18next"; +import { myAuth, setIsoData } from "@utils/app"; +import { isBrowser } from "@utils/browser"; +import { validEmail } from "@utils/helpers"; import { Component, linkEvent } from "inferno"; import { T } from "inferno-i18next-dess"; import { @@ -9,48 +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 { - isBrowser, - 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" ); } @@ -127,7 +95,7 @@ export class Signup extends Component { render() { return ( -
+
{ registerForm() { const siteView = this.state.siteRes.site_view; return ( -
-
{this.titleName(siteView)}
+ +

{this.titleName(siteView)}

{this.isLemmyMl && ( -
+
## @@ -157,12 +128,12 @@ export class Signup extends Component {
)} -
+
@@ -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" @@ -204,68 +175,39 @@ export class Signup extends Component { this.state.form.email && !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 && (
{
-
+
{ )} {this.renderCaptcha()} - {siteView.local_site.enable_nsfw && ( -
-
-
- - -
+
+
+
+ +
- )} +
{ value={this.state.form.honeypot} onInput={linkEvent(this, this.handleHoneyPotChange)} /> -
+
@@ -392,13 +331,13 @@ export class Signup extends Component { className="rounded-top img-fluid" src={this.captchaPngSrc(captchaRes)} style="border-bottom-right-radius: 0; border-bottom-left-radius: 0;" - alt={i18n.t("captcha")} + alt={I18NextService.i18n.t("captcha")} /> {captchaRes.wav && (