]> Untitled Git - lemmy.git/blobdiff - ui/src/components/setup.tsx
routes.api: fix get_captcha endpoint (#1135)
[lemmy.git] / ui / src / components / setup.tsx
index 029f22b96d1872bf6657c83def5bb7ffad8b67c2..6360ec5a36022e4fcb7d21aabc748c1b479dbc50 100644 (file)
@@ -1,4 +1,5 @@
 import { Component, linkEvent } from 'inferno';
+import { Helmet } from 'inferno-helmet';
 import { Subscription } from 'rxjs';
 import { retryWhen, delay, take } from 'rxjs/operators';
 import {
@@ -6,12 +7,11 @@ import {
   LoginResponse,
   UserOperation,
   WebSocketJsonResponse,
-} from '../interfaces';
+} from 'lemmy-js-client';
 import { WebSocketService, UserService } from '../services';
 import { wsJsonToRes, toast } from '../utils';
 import { SiteForm } from './site-form';
 import { i18n } from '../i18next';
-import { T } from 'inferno-i18next';
 
 interface State {
   userForm: RegisterForm;
@@ -29,6 +29,9 @@ export class Setup extends Component<any, State> {
       password_verify: undefined,
       admin: true,
       show_nsfw: true,
+      // The first admin signup doesn't need a captcha
+      captcha_uuid: '',
+      captcha_answer: '',
     },
     doneRegisteringUser: false,
     userLoading: false,
@@ -52,18 +55,17 @@ export class Setup extends Component<any, State> {
     this.subscription.unsubscribe();
   }
 
-  componentDidMount() {
-    document.title = `${i18n.t('setup')} - Lemmy`;
+  get documentTitle(): string {
+    return `${i18n.t('setup')} - Lemmy`;
   }
 
   render() {
     return (
       <div class="container">
+        <Helmet title={this.documentTitle} />
         <div class="row">
           <div class="col-12 offset-lg-3 col-lg-6">
-            <h3>
-                { i18n.t('lemmy_instance_setup') }
-            </h3>
+            <h3>{i18n.t('lemmy_instance_setup')}</h3>
             {!this.state.doneRegisteringUser ? (
               this.registerUser()
             ) : (
@@ -78,10 +80,10 @@ export class Setup extends Component<any, State> {
   registerUser() {
     return (
       <form onSubmit={linkEvent(this, this.handleRegisterSubmit)}>
-        <h4>{ i18n.t('setup_admin')}</h4>
+        <h5>{i18n.t('setup_admin')}</h5>
         <div class="form-group row">
-          <label class="col-sm-2 col-form-label" for="username">
-            { i18n.t('username') } 
+          <label class="col-sm-2 col-form-label" htmlFor="username">
+            {i18n.t('username')}
           </label>
           <div class="col-sm-10">
             <input
@@ -98,8 +100,8 @@ export class Setup extends Component<any, State> {
           </div>
         </div>
         <div class="form-group row">
-          <label class="col-sm-2 col-form-label" for="email">
-            { i18n.t('email') }
+          <label class="col-sm-2 col-form-label" htmlFor="email">
+            {i18n.t('email')}
           </label>
 
           <div class="col-sm-10">
@@ -115,8 +117,8 @@ export class Setup extends Component<any, State> {
           </div>
         </div>
         <div class="form-group row">
-          <label class="col-sm-2 col-form-label" for="password">
-            { i18n.t('password')}
+          <label class="col-sm-2 col-form-label" htmlFor="password">
+            {i18n.t('password')}
           </label>
           <div class="col-sm-10">
             <input
@@ -130,8 +132,8 @@ export class Setup extends Component<any, State> {
           </div>
         </div>
         <div class="form-group row">
-          <label class="col-sm-2 col-form-label" for="verify-password">
-            { i18n.t('verify_password') }
+          <label class="col-sm-2 col-form-label" htmlFor="verify-password">
+            {i18n.t('verify_password')}
           </label>
           <div class="col-sm-10">
             <input