]> Untitled Git - lemmy.git/commitdiff
Removing need for spam_timer
authorDessalines <tyhou13@gmx.com>
Wed, 15 May 2019 16:32:33 +0000 (09:32 -0700)
committerDessalines <tyhou13@gmx.com>
Wed, 15 May 2019 16:32:33 +0000 (09:32 -0700)
docs/api.md
server/src/api/user.rs
ui/src/components/login.tsx
ui/src/components/setup.tsx
ui/src/interfaces.ts

index 69229c167f21d340800754d623783279dfe44805..032c08aa5420fdfbbae5c06117469685f5768e19 100644 (file)
@@ -68,8 +68,7 @@ Only the first user will be able to be the admin.
     email: Option<String>,
     password: String,
     password_verify: String,
-    admin: bool,
-    spam_timeri: i64,
+    admin: bool
   }
 }
 ```
index ab0f24a5a1f59b944bfec420ff1671a949805c62..9361ca4d8152637493e7e1500005655a82d0a191 100644 (file)
@@ -15,7 +15,6 @@ pub struct Register {
   password: String,
   password_verify: String,
   admin: bool,
-  spam_timeri: i64,
 }
 
 #[derive(Serialize, Deserialize)]
@@ -133,10 +132,6 @@ impl Perform<LoginResponse> for Oper<Register> {
       return Err(APIError::err(&self.op, "Passwords do not match."))?
     }
 
-    if data.spam_timeri < 1142 {
-      return Err(APIError::err(&self.op, "Too fast"))?
-    }
-
     if has_slurs(&data.username) {
       return Err(APIError::err(&self.op, "No slurs"))?
     }
index b2ad70a16e46466375177dd66e6904a75c504a06..33cebdd6275a9a346384adb2da48f5d897692cb4 100644 (file)
@@ -10,7 +10,6 @@ interface State {
   registerForm: RegisterForm;
   loginLoading: boolean;
   registerLoading: boolean;
-  spamNada: string;
 }
 
 
@@ -27,11 +26,9 @@ export class Login extends Component<any, State> {
       password: undefined,
       password_verify: undefined,
       admin: false,
-      spam_timeri: undefined,
     },
     loginLoading: false,
     registerLoading: false,
-    spamNada: undefined
   }
 
   constructor(props: any, context: any) {
@@ -103,7 +100,6 @@ export class Login extends Component<any, State> {
     return (
       <form onSubmit={linkEvent(this, this.handleRegisterSubmit)}>
         <h5>Sign Up</h5>
-        <input type="text" class="no-s-hows" value={this.state.spamNada} onInput={linkEvent(this, this.handleSpamNada)} />
         <div class="form-group row">
           <label class="col-sm-2 col-form-label">Username</label>
           <div class="col-sm-10">
@@ -128,7 +124,6 @@ export class Login extends Component<any, State> {
             <input type="password" value={this.state.registerForm.password_verify} onInput={linkEvent(this, this.handleRegisterPasswordVerifyChange)} class="form-control" required />
           </div>
         </div>
-        <input type="hidden" value={this.state.registerForm.spam_timeri} />
         <div class="form-group row">
           <div class="col-sm-10">
             <button type="submit" class="btn btn-secondary">{this.state.registerLoading ? 
@@ -162,25 +157,11 @@ export class Login extends Component<any, State> {
     i.state.registerLoading = true;
     i.setState(i.state);
 
-    let endTimer = new Date().getTime();
-    let elapsed = endTimer - i.state.registerForm.spam_timeri;
-
-    i.state.registerForm.spam_timeri = elapsed;
-    if (elapsed > 1423 && i.state.spamNada == undefined) {
-      WebSocketService.Instance.register(i.state.registerForm);
-    } else {
-      window.location.href = "https://github.com/dessalines/lemmy";
-    }
+    WebSocketService.Instance.register(i.state.registerForm);
   }
 
   handleRegisterUsernameChange(i: Login, event: any) {
     i.state.registerForm.username = event.target.value;
-    i.state.registerForm.spam_timeri = new Date().getTime();
-    i.setState(i.state);
-  }
-
-  handleSpamNada(i: Login, event: any) {
-    i.state.spamNada = event.target.value;
     i.setState(i.state);
   }
 
index 83eff0c57acc73968cab5d310448c67edc0b1e64..edb98260c67f891e1795ab7df202b76712bafd70 100644 (file)
@@ -20,7 +20,6 @@ export class Setup extends Component<any, State> {
       username: undefined,
       password: undefined,
       password_verify: undefined,
-      spam_timeri: 3000,
       admin: true,
     },
     doneRegisteringUser: false,
index 1558f7ae7af83b31402d3b2153bdc92fba1cac9f..50cf2c71777557293b218dd9f6eecedcf14b8e41 100644 (file)
@@ -333,7 +333,6 @@ export interface RegisterForm {
   email?: string;
   password: string;
   password_verify: string;
-  spam_timeri: number;
   admin: boolean;
 }