netfrag.org > TWiki > VisualConfirmPlugin (r1.1 vs. r1.5)
TWiki . { Home? | Welcome | Register | Changes | Index | Search | Go }

 <<O>>  Difference Topic VisualConfirmPlugin (r1.5 - 03 Jan 2006 - KoenMartens?)
Line: 1 136 to 1 136
Changed:
<
<
Plugin Version: 07 Oct 2005 (V1.000)
>
>
Plugin Version: 03 Jan 2006 (V1.001)
Line: 139 to 140
Added:
>
>
03 Jan 2006: Fixed some problems with expiry, also optimised according to TWiki:TWiki.TWikiPlugins#FastPluginHints.
Line: 145 to 146
Changed:
<
<
TWiki:Plugins/Benchmark: GoodStyle nn%, FormattedSearch nn%, VisualConfirmPlugin nn%
>
>
TWiki:Plugins/Benchmark: GoodStyle 98%, FormattedSearch 98%, TWikiRegistration (patched) 85%

 <<O>>  Difference Topic VisualConfirmPlugin (r1.4 - 10 Oct 2005 - KoenMartens?)
Line: 1 138 to 1 139
Added:
>
>
10 Oct 2005: Strip hash and text from arguments to register binary, or they will end up in the newly created user topic.

 <<O>>  Difference Topic VisualConfirmPlugin (r1.3 - 09 Oct 2005 - KoenMartens?)
Line: 1 4 to 1 4
Changed:
<
<
Plugin for visual confirmation of new user registration.
>
>
Plugin for visual confirmation of new user registration, to prevent automated scripts to create users and spam your wiki with their url's to get a better google ranking.
Line: 16 to 16
Changed:
<
<
  • None yet
>
>
  • N/A
Line: 28 to 28
Changed:
<
<
  • My own setting:
    • Set CHARACTERS = ABC
    • Set FONT = luximb.ttf
    • Set NOISE = kjfksd
    • Set LINES = 3
    • Set CIRCLES = 20
>
>
  • Custom settings (defaults shown):
    • Characters to use in generated strings:
      • Set CHARACTERS = ABCDEFGHKLMNPRSTVWXYZabcdeghpqsuvwxy@
    • Truetype font to use:
      • Set FONT = luxisbi.ttf
    • Number of random lines to add (use none for 0):
      • Set LINES = 10
    • Number of random circles to add (use none for 0):
      • Set CIRCLES = 10
    • Noise, percentage of pixels to flip randomly after generating graphics (use none for 0%):
      • Set NOISE = 15
Line: 42 to 47
Changed:
<
<
data/TWiki/VisualConfirmPlugin.txt Plugin topic
data/TWiki/VisualConfirmPlugin.txt,v Plugin topic repository
>
>
data/TWiki/VisualConfirmPlugin.txt Plugin topic
data/TWiki/VisualConfirmPlugin.txt,v Plugin topic repository
register.patch Patch for the register binary
templates/oopsregvisualconfirm.tmpl Error template
Line: 44 to 52
Added:
>
>
  • Apply the patch register.patch to bin/register (alternatively, patch register manual, see section below):
    • cd bin
    • patch < ../register.patch
  • Create the directories visualconfirm and visualconfirm/db in your pub/ directory, and make sure it is readable and writable by the user that TWiki is executing as.
    • mkdir -p pub/visualconfirm/db
    • chown -R nobody pub/visualconfirm
    • chmod -R 644 pub/visualconfirm
  • Restrict access to the database files, for example, by including the following in your httpd.conf:
         <Directory "/path/to/twiki/pub/visualconfirm/db">
           deny from all
         </Directory>
  • Make sure the plugin has access to the preferred truetype font, by putting the .ttf file in pub/visualconfirm/
Line: 46 to 67
Changed:
<
<
    • enter samples here
>
>
    • Create a topic containing <IMG SRC="%VISUALCONFIRMURL%"> and %VISUALCONFIRMHASH%
    • When loading this topic you should see an obfuscated character string loaded as a png and a hexadecimal hash.
    • Check whether the hash database is properly protected by going to the url http://my.twiki.server/my/twiki/path/pub/visualconfirm/db/hashes.pag, you should see a permission denied message.
  • Now edit your TWikiRegistration topic
    • Display the image %VISUALCONFIRMURL% somewhere in your form, along with a text instructing new users to copy the obfuscated text into the appropriate text input.
    • Add the appropriate text input as Twk1VisualConfirm
    • Add a hidden input as Twk1VisualConfirmHash
    • For example, add this to your TWikiRegistration:
            <tr>
              <td valign="top" align="right"><IMG SRC="%VISUALCONFIRMURL%">: <br /> (..)   </td>
              <td><input type="hidden" name="Twk1VisualConfirmHash" value="%VISUALCONFIRMHASH%">
                  <input type="text" name="Twk1VisualConfirm" size="5"></td>
            </tr>
  • That's it.

Manually patching the register binary

Find the line in bin/register that says:

    # everything OK

Insert the code below directly BEFORE that line:

    # check valid visual confirmation
    for( $x = 0; $x < $formLen; $x++ ) {
      $vcHash=$formDataValue[$x]
        unless(not($formDataName[$x] eq "Visual Confirm Hash"));
      $vcTxt=$formDataValue[$x]
        unless(not($formDataName[$x] eq "Visual Confirm"));
    }

    open(LOCKFILE,">".&TWiki::getPubDir()."/visualconfirm/db/hashes.lock");
    flock(LOCKFILE,2);

    dbmopen(%database, &TWiki::getPubDir()."/visualconfirm/db/hashes" ,0644);

    if(!defined($database{$vcHash})) {
      $url = &TWiki::getOopsUrl( $webName, $topic, "oopsregvisualconfirm",
        "The visual confirmation has expired.");
      TWiki::redirect( $query, $url );
      return;
    }

    my ($time,$txt)=split(',',$database{$vcHash});

    if(not(lc($txt) eq lc($vcTxt))) {
      $url = &TWiki::getOopsUrl( $webName, $topic, "oopsregvisualconfirm",
        "The character string you entered for visual confirmation is incorrect.");
      TWiki::redirect( $query, $url );
      return;
    }
    dbmclose(%database);

    close(LOCKFILE);

Further Development

  • Make number of characters configurable
  • Make font size configurable
  • Find out how to safely delete images from the register binary
Line: 67 to 152
Changed:
<
<
-- KoenMartens? - 07 Oct 2005
>
>
-- TWiki:Main.KoenMartens - 07 Oct 2005

 <<O>>  Difference Topic VisualConfirmPlugin (r1.2 - 08 Oct 2005 - KoenMartens?)
Line: 1 29 to 1 29
Changed:
<
<
    • Set HOWTO = got it!
>
>
    • Set CHARACTERS = ABC
    • Set FONT = luximb.ttf
    • Set NOISE = kjfksd
    • Set LINES = 3
    • Set CIRCLES = 20

 <<O>>  Difference Topic VisualConfirmPlugin (r1.1 - 07 Oct 2005 - KoenMartens?)
Line: 1 to 1
Added:
>
>

VisualConfirmPlugin

Plugin for visual confirmation of new user registration.


Syntax Rules

  • None

Examples

  • None yet

Plugin Settings

Plugin settings are stored as preferences variables. To reference a plugin setting write %<plugin>_<setting>%, i.e. %INTERWIKIPLUGIN_SHORTDESCRIPTION%

  • One line description, is shown in the TextFormattingRules topic:
    • Set SHORTDESCRIPTION = Plugin for visual confirmation of new user registration.

  • Debug plugin: (See output in data/debug.txt)
    • Set DEBUG = 1

  • My own setting:
    • Set HOWTO = got it!

Plugin Installation Instructions

Note: You do not need to install anything on the browser to use this plugin. The following instructions are for the administrator who installs the plugin on the server where TWiki is running.

  • Download the ZIP file from the Plugin web (see below)
  • Unzip VisualConfirmPlugin.zip in your twiki installation directory. Content:
    File: Description: down
    lib/TWiki/Plugins/VisualConfirmPlugin.pm Plugin Perl module
    data/TWiki/VisualConfirmPlugin.txt Plugin topic
    data/TWiki/VisualConfirmPlugin.txt,v Plugin topic repository
  • Test if the installation was successful:
    • enter samples here

Plugin Info

Plugin Author: TWiki:Main.KoenMartens
Plugin Version: 07 Oct 2005 (V1.000)
Change History: <!-- versions below in reverse order --> 
07 Oct 2005: Initial version
TWiki Dependency: $TWiki::Plugins::VERSION 1.024
CPAN Dependencies: GD, Digest::MD5
Other Dependencies: none
Perl Version: 5.005
License: GPL (GNU General Public License)
TWiki:Plugins/Benchmark: GoodStyle nn%, FormattedSearch nn%, VisualConfirmPlugin nn%
Plugin Home: http://TWiki.org/cgi-bin/view/Plugins/VisualConfirmPlugin
Feedback: http://TWiki.org/cgi-bin/view/Plugins/VisualConfirmPluginDev
Appraisal: http://TWiki.org/cgi-bin/view/Plugins/VisualConfirmPluginAppraisal

Related Topics: TWikiPreferences, TWikiPlugins

-- KoenMartens? - 07 Oct 2005


Topic VisualConfirmPlugin . { View | Diffs | r1.5 | > | r1.4 | > | r1.3 | More }    output as: { }
Revision r1.1 - 07 Oct 2005 - 17:05 - KoenMartens?
Revision r1.5 - 03 Jan 2006 - 22:07 - KoenMartens?