Permalink
Browse files

Added recaptcha fields to configuration file.

  • Loading branch information...
1 parent 3558abb commit 4dc907cdc062fadce1d0051a6df952f9a833234b @jgm committed Dec 31, 2008
Showing with 73 additions and 50 deletions.
  1. +32 −26 Gitit/State.hs
  2. +26 −12 README.markdown
  3. +15 −12 data/SampleConfig.hs
View
@@ -40,36 +40,42 @@ import qualified Data.ByteString.Lazy.UTF8 as L (fromString)
-- | Data structure for information read from config file.
data Config = Config {
- repositoryPath :: FilePath, -- path of git repository for pages
- userFile :: FilePath, -- path of users database
- templateFile :: FilePath, -- path of page template file
- staticDir :: FilePath, -- path of static directory
- tableOfContents :: Bool, -- should each page have an automatic table of contents?
- maxUploadSize :: Integer, -- maximum size of pages and file uploads
- portNumber :: Int, -- port number to serve content on
- debugMode :: Bool, -- should debug info be printed to the console?
- frontPage :: String, -- the front page of the wiki
- noEdit :: [String], -- pages that cannot be edited through the web interface
- noDelete :: [String], -- pages that cannot be deleted through the web interface
- accessQuestion :: Maybe (String, [String]) -- if Nothing, then anyone can register for an account.
- -- if Just (prompt, answers), then a user will be given the prompt
- -- and must give one of the answers in order to register.
+ repositoryPath :: FilePath, -- path of git repository for pages
+ userFile :: FilePath, -- path of users database
+ templateFile :: FilePath, -- path of page template file
+ staticDir :: FilePath, -- path of static directory
+ tableOfContents :: Bool, -- should each page have an automatic table of contents?
+ maxUploadSize :: Integer, -- maximum size of pages and file uploads
+ portNumber :: Int, -- port number to serve content on
+ debugMode :: Bool, -- should debug info be printed to the console?
+ frontPage :: String, -- the front page of the wiki
+ noEdit :: [String], -- pages that cannot be edited through the web interface
+ noDelete :: [String], -- pages that cannot be deleted through the web interface
+ accessQuestion :: Maybe (String, [String]), -- if Nothing, then anyone can register for an account.
+ -- if Just (prompt, answers), then a user will be given the prompt
+ -- and must give one of the answers in order to register.
+ useRecaptcha :: Bool, -- use ReCAPTCHA service to provide captchas for user registration.
+ recaptchaPublicKey :: String,
+ recaptchaPrivateKey :: String
} deriving (Read, Show,Eq,Typeable,Data)
defaultConfig :: Config
defaultConfig = Config {
- repositoryPath = "wikidata",
- userFile = "gitit-users",
- templateFile = "template.html",
- staticDir = "static",
- tableOfContents = True,
- maxUploadSize = 100000,
- portNumber = 5001,
- debugMode = False,
- frontPage = "Front Page",
- noEdit = ["Help"],
- noDelete = ["Help", "Front Page"],
- accessQuestion = Nothing
+ repositoryPath = "wikidata",
+ userFile = "gitit-users",
+ templateFile = "template.html",
+ staticDir = "static",
+ tableOfContents = True,
+ maxUploadSize = 100000,
+ portNumber = 5001,
+ debugMode = False,
+ frontPage = "Front Page",
+ noEdit = ["Help"],
+ noDelete = ["Help", "Front Page"],
+ accessQuestion = Nothing,
+ useRecaptcha = False,
+ recaptchaPublicKey = "",
+ recaptchaPrivateKey = ""
}
type SessionKey = Integer
View
@@ -93,18 +93,21 @@ You can set some configuration options when starting gitit, using the
option `-f [filename]`. A configuration file takes the following form:
Config {
- repositoryPath = "wikidata",
- userFile = "gitit-users",
- templateFile = "template.html",
- staticDir = "static",
- tableOfContents = False,
- maxUploadSize = 100000,
- portNumber = 5001,
- debugMode = True,
- frontPage = "Front Page",
- noEdit = ["Help", "Front Page"],
- noDelete = ["Help", "Front Page"],
- accessQuestion = Just ("Enter the access code (to request an access code, contact me@somewhere.org):", ["abcd"])
+ repositoryPath = "wikidata",
+ userFile = "gitit-users",
+ templateFile = "template.html",
+ staticDir = "static",
+ tableOfContents = False,
+ maxUploadSize = 100000,
+ portNumber = 5001,
+ debugMode = True,
+ frontPage = "Front Page",
+ noEdit = ["Help", "Front Page"],
+ noDelete = ["Help", "Front Page"],
+ accessQuestion = Just ("Enter the access code (to request an access code, contact me@somewhere.org):", ["abcd"]),
+ useRecaptcha = False,
+ recaptchaPublicKey = "",
+ recaptchaPrivateKey = ""
}
- `repositoryPath` is the (relative) path of the git repository in which
@@ -149,6 +152,17 @@ option `-f [filename]`. A configuration file takes the following form:
`answer1, answer2, ...` are the valid responses. The user must provide a
valid response in order to create an account.
+- `useRecaptcha` specifies whether to use the [reCAPTCHA] service to provide
+ captchas for user registration.
+
+- `recaptchaPublicKey` is a reCAPTCHA public key (which can be obtained free
+ of charge by signing up at the [reCAPTCHA] site).
+
+- `recaptchaPrivateKey` is the reCAPTCHA private key that goes with the public
+ key.
+
+[reCAPTCHA]: http://recaptcha.net
+
Configuring gitit
=================
View
@@ -1,15 +1,18 @@
Config {
-repositoryPath = "wikidata",
-userFile = "gitit-users",
-templateFile = "template.html",
-staticDir = "static",
-tableOfContents = False,
-maxUploadSize = 100000,
-portNumber = 5001,
-debugMode = True,
-frontPage = "Front Page",
-noEdit = ["Help", "Front Page"],
-noDelete = ["Help", "Front Page"],
-accessQuestion = Just ("Enter the access code (to request an access code, contact me@somewhere.org):", ["abcd"])
+repositoryPath = "wikidata",
+userFile = "gitit-users",
+templateFile = "template.html",
+staticDir = "static",
+tableOfContents = False,
+maxUploadSize = 100000,
+portNumber = 5001,
+debugMode = True,
+frontPage = "Front Page",
+noEdit = ["Help", "Front Page"],
+noDelete = ["Help", "Front Page"],
+accessQuestion = Just ("Enter the access code (to request an access code, contact me@somewhere.org):", ["abcd"]),
+useRecaptcha = False,
+recaptchaPublicKey = "",
+recaptchaPrivateKey = ""
}

0 comments on commit 4dc907c

Please sign in to comment.