From: Dessalines Date: Fri, 26 Apr 2019 14:34:04 +0000 (-0700) Subject: Fixing rust warning. X-Git-Url: http://these/git/%24%7BgetStaticDir%28%29%7D/styles/%7BelementUrl%7D?a=commitdiff_plain;h=be943f7b72be5c2471419e2405eb194e33fa5165;p=lemmy.git Fixing rust warning. - Fixes #111 --- diff --git a/server/Cargo.toml b/server/Cargo.toml index 93bd6acb..1daaca66 100644 --- a/server/Cargo.toml +++ b/server/Cargo.toml @@ -2,6 +2,7 @@ name = "server" version = "0.0.1" authors = ["Dessalines "] +autobins = false [[bin]] name = "lemmy" diff --git a/server/src/websocket_server/server.rs b/server/src/websocket_server/server.rs index dbd1be8d..d6a9226b 100644 --- a/server/src/websocket_server/server.rs +++ b/server/src/websocket_server/server.rs @@ -92,6 +92,7 @@ pub struct Register { password: String, password_verify: String, admin: bool, + spam_timer: i64, } #[derive(Serialize, Deserialize)] @@ -789,6 +790,10 @@ impl Perform for Register { return Err(self.error("Passwords do not match."))? } + if self.spam_timer < 1142 { + return Err(self.error("Too fast"))? + } + if has_slurs(&self.username) { return Err(self.error("No slurs"))? } diff --git a/ui/src/components/login.tsx b/ui/src/components/login.tsx index e6dec2d2..0713b776 100644 --- a/ui/src/components/login.tsx +++ b/ui/src/components/login.tsx @@ -10,7 +10,6 @@ interface State { registerForm: RegisterForm; loginLoading: boolean; registerLoading: boolean; - spamTimer: number; } @@ -27,10 +26,10 @@ export class Login extends Component { password: undefined, password_verify: undefined, admin: false, + spam_timer: undefined, }, loginLoading: false, registerLoading: false, - spamTimer: new Date().getTime() } constructor(props: any, context: any) { @@ -126,7 +125,7 @@ export class Login extends Component { - +