about summary refs log tree commit diff
path: root/src/Blog.hs
diff options
context:
space:
mode:
author"Vincent Ambo ext:(%22) <tazjin@gmail.com>2013-04-28T11·11+0200
committer"Vincent Ambo ext:(%22) <tazjin@gmail.com>2013-04-28T11·11+0200
commitb3fb7f0f341bf3574a5c42fbbf3e0ddc3ea286a1 (patch)
tree0bb3b0ef603f01d42a4922a8f7b59187208daebc /src/Blog.hs
parent1bdbe4af642cbaaacb15fbf882a3ad87ebf1e486 (diff)
* re-enabled captchas
Diffstat (limited to 'src/Blog.hs')
-rw-r--r--src/Blog.hs20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/Blog.hs b/src/Blog.hs
index 4906ad5d4004..10b118861568 100644
--- a/src/Blog.hs
+++ b/src/Blog.hs
@@ -152,15 +152,35 @@ $forall comment <- comments
   where
    timeString = formatTime defaultTimeLocale (cTimeFormat lang)
 
+captcha :: Html
+captcha = [shamlet|
+<div class="cCaptcha">
+  <script src="http://api.recaptcha.net/challenge?k=6LfQXccSAAAAAIjKm26XlFnBMAgvaKlOAjVWEEnM" type="text/javascript">
+  <noscript>
+    <iframe src="http://api.recaptcha.net/noscript?k=6LfQXccSAAAAAIjKm26XlFnBMAgvaKlOAjVWEEnM" height="300" width="500" seamless>
+      <br>
+      <textarea name="recaptcha_challenge_field" rows="3" cols="40">
+      <input type="hidden" name="recaptcha_response_field" value="manual_challenge">
+|]
+
+captchaOptions :: BlogLang ->  Html
+captchaOptions lang = [shamlet|<script type="text/javascript">^{preEscapedToHtml options}|]
+  where
+    options = T.concat ["var RecaptchaOptions = { theme: 'clean', lang: '", showLangText lang, "'};"]
+
 
 renderCommentBox :: BlogLang -> EntryId -> Html
 renderCommentBox cLang cId = [shamlet|
 <div class="cHead">#{cwHead cLang}
+^{captchaOptions cLang}
 <form method="POST" action=#{aLink}>
  <p><input name="cname" placeholder="Name" class="cInput">
  <p>
   <label>
    <textarea name="ctext" cols="50" rows="13" class="cInput" placeholder=#{cTextPlaceholder cLang}>
+ <p>
+  <label>
+   ^{captcha}
  <p><input class="cInput" style="width:120px;" type="submit" value=#{cSend cLang}>
 |]
   where