From a1ab75e555184a2f15bff1b57058074d717a7d8a Mon Sep 17 00:00:00 2001 From: Grzegorz Adam Hankiewicz Date: Fri, 29 Mar 2013 14:43:51 +0100 Subject: [PATCH] Checks user input length after removing whitespace. Refs #2. --- forum.nim | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/forum.nim b/forum.nim index 4173eb3..db87773 100644 --- a/forum.nim +++ b/forum.nim @@ -321,10 +321,13 @@ proc crud(c: TCrud, table: string, data: varargs[string]): TSqlQuery = template retrSubject(c: expr) = let subject {.inject.} = c.req.params["subject"] - if subject.len < 3: return setError(c, "subject", "Subject not long enough") - + if subject.strip.len < 3: + return setError(c, "subject", "Subject not long enough") + template retrContent(c: expr) = let content {.inject.} = c.req.params["content"] + if content.strip.len < 10: + return setError(c, "content", "Content not long enough") if not validateRst(c, content): return false template retrPost(c: expr) =