As I'm using Screwturn Wiki for this personal site for my own convenience (not as a real Wiki), I've had to tweak the permissions in a couple of unusual ways, eg allowing anyone to post messages to me and allowing anyone to contribute to "Discussions" pages without being logged in.
To make this work, these pages need to be protected by "Captcha" logic the same way as user registration (which I have disabled) is.
So I started digging around in Screwturn Wiki's innards and very much liked what I saw! It is incredibly simple to edit an existing page or make a completely new page with unique functionality but inheriting the look & feel of the site - every "special" page is a regular aspx page with on-the-fly compiled aspx.cs codebehind files.
In any case, here's what I had to do:
Message.aspx to add the captcha control and from email label & field, plus the validation summary
Message.aspx.cs to add the validation handling, captcha hiding, etc.
Post.aspx (for discussions) to add the captcha control, plus the validation summary
Post.aspx.cs to add the validation handling, captcha hiding, etc.
Patch files for Screwturn Wiki 2.0.7: CaptchaPatches.zip
(created with ExamDiff
There are some "Issues" in my implementation, should it ever make it back into the main code:
- The code was randomly hacked in, no regard for thestructure / standards behind the original code, or much consideration for page layout (the captcha label looks ugly on message posting page)
- The captcha image is still always CREATED by the register.aspx page... (captcha generation should be moved into another separate page)
- The "From Email" error message in Messages.aspx.cs is Hardcoded (not resource), and the resources for non-Desktop edition labels in the aspx file do not exist (Cassini ignores these it seems, so this is not a problem for me) - I didn't want to be making changes to resource files.