Checks user input length after removing whitespace. Refs #2.
This commit is contained in:
parent
f9fa9b4503
commit
a1ab75e555
1 changed files with 5 additions and 2 deletions
|
|
@ -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) =
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue