password: String,
password_verify: String,
admin: bool,
- spam_timeri: i64,
}
#[derive(Serialize, Deserialize)]
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"))?
}
registerForm: RegisterForm;
loginLoading: boolean;
registerLoading: boolean;
- spamNada: string;
}
password: undefined,
password_verify: undefined,
admin: false,
- spam_timeri: undefined,
},
loginLoading: false,
registerLoading: false,
- spamNada: undefined
}
constructor(props: any, context: any) {
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">
<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 ?
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);
}