diff options
Diffstat (limited to 'haunt/jakob/dynamic/capabilities')
| -rw-r--r-- | haunt/jakob/dynamic/capabilities/comment-form.scm | 13 | ||||
| -rw-r--r-- | haunt/jakob/dynamic/capabilities/comments.scm | 8 |
2 files changed, 9 insertions, 12 deletions
diff --git a/haunt/jakob/dynamic/capabilities/comment-form.scm b/haunt/jakob/dynamic/capabilities/comment-form.scm index 70e5303..1754dfd 100644 --- a/haunt/jakob/dynamic/capabilities/comment-form.scm +++ b/haunt/jakob/dynamic/capabilities/comment-form.scm @@ -30,14 +30,13 @@ #:export (get-comment-form)) (define (render-comment-form slug) - (let-values (((mac solution captcha-image) (new-captcha))) + (let-values (((captcha-id captcha-image) (new-captcha!))) `((div (@ (id "comment-form")) (h1 "Comment form") (form (@ (id "comment-input") (action "/api/comment") (method "post")) (input (@ (type "text") (name "slug") (hidden #t) (value ,slug))) - (input (@ (type "text") (name "solution") (hidden #t) (value ,solution))) - (input (@ (type "text") (name "solution-mac") (hidden #t) (value ,mac))) - (fieldset + (input (@ (type "text") (name "captcha-id") (hidden #t) (value ,captcha-id))) + (fieldset (@ (id "commenter-info")) (legend "Commenter Info") (label (@ (for "name")) "Name:") (input (@ (type "text") (id "name") (name "name") (required #t) (size 24))) @@ -45,15 +44,15 @@ (input (@ (type "text") (id "email") (name "email") (size 24))) (label (@ (for "url")) "Webpage URL (optional):") (input (@ (type "text") (id "url") (name "url") (size 24)))) - (fieldset + (fieldset (@ (id "comment-content")) (legend "Comment") (label (@ (for "subject")) "Subject (optional):") (input (@ (type "text") (id "subject") (name "subject") (size 24))) (label (@ (for "comment")) "Comment :") (textarea (@ (id "coment") (name "comment") (rows 4) (cols 50)))) - (fieldset + (fieldset (@ (id "comment-captcha")) (legend "Captcha") - (label (@ (for "captcha")) "Captcha:") + (label (@ (for "captcha")) "Please evaluate the following definite integral:") (img (@ (src ,(format #f "data:image/jpeg;charset=utf-8;base64,~a" (base64-encode captcha-image))))) (input (@ (type "text") (id "captcha") (name "captcha") (size 24))) diff --git a/haunt/jakob/dynamic/capabilities/comments.scm b/haunt/jakob/dynamic/capabilities/comments.scm index 3e873a6..72067b4 100644 --- a/haunt/jakob/dynamic/capabilities/comments.scm +++ b/haunt/jakob/dynamic/capabilities/comments.scm @@ -81,12 +81,10 @@ This is a wrapper around `get-comments-by-slug'." (assoc "name" form-data) (assoc "comment" form-data) (assoc "captcha" form-data) - (assoc "solution" form-data) - (assoc "solution-mac" form-data) - (validate-captcha + (assoc "captcha-id" form-data) + (validate-captcha! (assoc-value form-data "captcha") - (assoc-value form-data "solution") - (assoc-value form-data "solution-mac")))) + (string->number (assoc-value form-data "captcha-id"))))) (define (insert-comment form-data) (exec-query conn "INSERT INTO comments (submitted, slug, name, subject, |