From b8d7ae91d0199003173ea3c581404d66538a3fba Mon Sep 17 00:00:00 2001 From: joshtriplett Date: Wed, 9 May 2007 02:05:32 +0000 Subject: [PATCH] * Add an account-creation password as a simple anti-spam mechanism. If set in the wiki setup, passwordauth will require the password in order to create an account. --- IkiWiki.pm | 1 + IkiWiki/Plugin/passwordauth.pm | 8 ++++++++ debian/changelog | 8 +++++++- doc/ikiwiki.setup | 2 ++ 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/IkiWiki.pm b/IkiWiki.pm index 1d764bae2..aea5b7abf 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -78,6 +78,7 @@ sub defaultconfig () { #{{{ userdir => "", usedirs => 1, numbacklinks => 10, + account_creation_password => "", } #}}} sub checkconfig () { #{{{ diff --git a/IkiWiki/Plugin/passwordauth.pm b/IkiWiki/Plugin/passwordauth.pm index a2e774c36..1520cea83 100644 --- a/IkiWiki/Plugin/passwordauth.pm +++ b/IkiWiki/Plugin/passwordauth.pm @@ -26,6 +26,7 @@ sub formbuilder_setup (@) { #{{{ if ($form->submitted eq "Register" || $form->submitted eq "Create Account") { $form->field(name => "confirm_password", type => "password"); + $form->field(name => "account_creation_password", type => "password") if (length $config{account_creation_password}); $form->field(name => "email", size => 50); $form->title("register"); $form->text(""); @@ -51,6 +52,13 @@ sub formbuilder_setup (@) { #{{{ shift eq $form->field("password"); }, ); + $form->field( + name => "account_creation_password", + validate => sub { + shift eq $config{account_creation_password}; + }, + required => 1, + ) if (length $config{account_creation_password}); $form->field( name => "email", validate => "EMAIL", diff --git a/debian/changelog b/debian/changelog index 7e0058c98..455e3e7f0 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,5 +1,6 @@ ikiwiki (2.1) UNRELEASED; urgency=low + [ Joey Hess ] * Use div layout for the signin and preferences forms, so that they can be styled using the stylesheet, rather than by creating signin and prefs templates. @@ -14,7 +15,12 @@ ikiwiki (2.1) UNRELEASED; urgency=low * Add the needsbuild hook. Plugins can use this to manipulate which files ikiwiki builds when refreshing the wiki. - -- Joey Hess Tue, 08 May 2007 20:44:27 -0400 + [ Josh Triplett ] + * Add an account-creation password as a simple anti-spam mechanism. If + set in the wiki setup, passwordauth will require the password in + order to create an account. + + -- Josh Triplett Tue, 08 May 2007 19:05:21 -0700 ikiwiki (2.00) unstable; urgency=low diff --git a/doc/ikiwiki.setup b/doc/ikiwiki.setup index d498e8dfa..31561e20f 100644 --- a/doc/ikiwiki.setup +++ b/doc/ikiwiki.setup @@ -99,6 +99,8 @@ use IkiWiki::Setup::Standard { #userdir => "users", # To create output files named page.html rather than page/index.html. #usedirs => 0, + # Simple spam prevention: require an account-creation password. + #account_creation_password => "example", # To add plugins, list them here. #add_plugins => [qw{goodstuff search wikitext camelcase -- 2.44.0