summaryrefslogtreecommitdiff
path: root/src/site.clj
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2012-12-29 23:32:47 -0500
committerJules Laplace <jules@okfoc.us>2012-12-29 23:32:47 -0500
commit064860c2948c19b967e15baf081daed93d77e7b8 (patch)
treeab6b50e16ccf8a33fbc06e06fcd6fcf17d7c1d3e /src/site.clj
parent65263103e2aba86a1735cb3a699a1350ae739c37 (diff)
check if ip created an account
Diffstat (limited to 'src/site.clj')
-rw-r--r--src/site.clj7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/site.clj b/src/site.clj
index e47e121..a114cf4 100644
--- a/src/site.clj
+++ b/src/site.clj
@@ -293,6 +293,10 @@ WHERE user_id IN
(do-select [muted-ips-query])))]
(contains? muted-ips ip)))
+; this should check if the user was created in the last day i guess
+(defn ip-recently-created? [ip]
+ (> (count (do-select ["select count(*) from users where created_ip=?::cidr" (str ip)] )) 1))
+
(def *reserved-nicks-path* "docs/reserved_nicks.txt")
(def *reserved-nicks-refresh-period-sec* 300)
@@ -317,7 +321,8 @@ WHERE user_id IN
invalid-nick-reason (is-invalid-nick? nick)]
(cond invalid-nick-reason (resp-error invalid-nick-reason)
(nick-reserved? nick) (resp-error "NICK_TAKEN")
- (ip-recently-muted? ip) (resp-error "RECENTLY_MUTED")
+ (ip-recently-muted? ip) (resp-error "RECENTLY_MUTED")
+ (ip-recently-created? ip) (resp-error "RECENTLY_CREATED")
:else (do
(do-insert :users
[:nick :hash :email]