X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/f46c35f46f29f56ffb701e6db8e5dc645162da07..ffae58a97865d24796826f4b4ff9da82aef93116:/IkiWiki/Plugin/passwordauth.pm diff --git a/IkiWiki/Plugin/passwordauth.pm b/IkiWiki/Plugin/passwordauth.pm index 86a5ba49e..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", @@ -189,7 +197,7 @@ sub formbuilder (@) { #{{{ if ($form->submitted eq "Save Preferences" && $form->validate) { my $user_name=$form->field('name'); foreach my $field (qw(password)) { - if (defined $form->field($field) && length $form->field($field)) { + if (defined $form->field($field)) { IkiWiki::userinfo_set($user_name, $field, $form->field($field)) || error("failed to set $field"); }