mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-16 09:24:00 +00:00
commit
c8d820a6da
9 changed files with 48 additions and 7 deletions
|
@ -1,6 +1,8 @@
|
|||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
export DATABASE_URL=postgres://rrr:rrr@localhost/rrr
|
||||
|
||||
cd ui
|
||||
yarn
|
||||
yarn build
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
name = "server"
|
||||
version = "0.0.1"
|
||||
authors = ["Dessalines <happydooby@gmail.com>"]
|
||||
autobins = false
|
||||
|
||||
[[bin]]
|
||||
name = "lemmy"
|
||||
|
|
|
@ -92,6 +92,7 @@ pub struct Register {
|
|||
password: String,
|
||||
password_verify: String,
|
||||
admin: bool,
|
||||
spam_timeri: i64,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
|
@ -789,6 +790,10 @@ impl Perform for Register {
|
|||
return Err(self.error("Passwords do not match."))?
|
||||
}
|
||||
|
||||
if self.spam_timeri < 1142 {
|
||||
return Err(self.error("Too fast"))?
|
||||
}
|
||||
|
||||
if has_slurs(&self.username) {
|
||||
return Err(self.error("No slurs"))?
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ export class Communities extends Component<any, CommunitiesState> {
|
|||
|
||||
let listCommunitiesForm: ListCommunitiesForm = {
|
||||
sort: SortType[SortType.TopAll],
|
||||
limit: 9999,
|
||||
limit: 100,
|
||||
}
|
||||
|
||||
WebSocketService.Instance.listCommunities(listCommunitiesForm);
|
||||
|
|
|
@ -120,7 +120,10 @@ export class CommunityForm extends Component<CommunityFormProps, CommunityFormSt
|
|||
if (i.props.community) {
|
||||
WebSocketService.Instance.editCommunity(i.state.communityForm);
|
||||
} else {
|
||||
WebSocketService.Instance.createCommunity(i.state.communityForm);
|
||||
|
||||
setTimeout(function(){
|
||||
WebSocketService.Instance.createCommunity(i.state.communityForm);
|
||||
}, 10000);
|
||||
}
|
||||
i.setState(i.state);
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ interface State {
|
|||
registerForm: RegisterForm;
|
||||
loginLoading: boolean;
|
||||
registerLoading: boolean;
|
||||
spamNada: string;
|
||||
}
|
||||
|
||||
|
||||
|
@ -26,9 +27,11 @@ export class Login extends Component<any, State> {
|
|||
password: undefined,
|
||||
password_verify: undefined,
|
||||
admin: false,
|
||||
spam_timeri: undefined,
|
||||
},
|
||||
loginLoading: false,
|
||||
registerLoading: false
|
||||
registerLoading: false,
|
||||
spamNada: undefined
|
||||
}
|
||||
|
||||
constructor(props: any, context: any) {
|
||||
|
@ -100,6 +103,7 @@ 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">
|
||||
|
@ -124,6 +128,7 @@ 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 ?
|
||||
|
@ -157,11 +162,26 @@ export class Login extends Component<any, State> {
|
|||
i.state.registerLoading = true;
|
||||
i.setState(i.state);
|
||||
event.preventDefault();
|
||||
WebSocketService.Instance.register(i.state.registerForm);
|
||||
|
||||
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";
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
import { Component } from 'inferno';
|
||||
|
||||
let general =
|
||||
["Eduardo Cavazos"];
|
||||
[
|
||||
"Nathan J. Goode",
|
||||
"Eduardo Cavazos"
|
||||
];
|
||||
// let highlighted = [];
|
||||
// let silver = [];
|
||||
// let gold = [];
|
||||
|
@ -43,10 +46,10 @@ export class Sponsors extends Component<any, any> {
|
|||
}
|
||||
sponsors() {
|
||||
return (
|
||||
<div>
|
||||
<div class="container">
|
||||
<h5>Sponsors</h5>
|
||||
<p>General Sponsors are those that pledged $10 to $39 to Lemmy.</p>
|
||||
<div class="">
|
||||
<div class="row card-columns">
|
||||
{general.map(s =>
|
||||
<div class="card col-12 col-md-2">
|
||||
<div>{s}</div>
|
||||
|
|
|
@ -100,3 +100,9 @@ blockquote {
|
|||
max-height: 50px;
|
||||
max-width: 50px;
|
||||
}
|
||||
|
||||
.no-s-hows {
|
||||
position: absolute !important;
|
||||
top: -9999px !important;
|
||||
left: -9999px !important;
|
||||
}
|
||||
|
|
|
@ -330,6 +330,7 @@ export interface RegisterForm {
|
|||
email?: string;
|
||||
password: string;
|
||||
password_verify: string;
|
||||
spam_timeri: number;
|
||||
admin: boolean;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue