]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/Plugin/passwordauth.pm
web commit by hb: typo
[git.ikiwiki.info.git] / IkiWiki / Plugin / passwordauth.pm
index dac649bc86c81f38a8e6ae1386c880449524bb15..1520cea837c5a5b014bcab4b4763930ac0059cdb 100644 (file)
@@ -21,15 +21,12 @@ sub formbuilder_setup (@) { #{{{
        my $cgi=$params{cgi};
 
        if ($form->title eq "signin" || $form->title eq "register") {
-               my %fieldset = ();
-               if ($form->title eq "signin") {
-                       $fieldset{"fieldset"} = gettext("Log in with")." ".htmllink("", "", "passwordauth", noimageinline => 1);
-               }
-               $form->field(name => "name", required => 0, size => 50, %fieldset);
-               $form->field(name => "password", type => "password", required => 0, %fieldset);
+               $form->field(name => "name", required => 0);
+               $form->field(name => "password", type => "password", required => 0);
                
                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("");
@@ -55,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",
@@ -105,7 +109,7 @@ sub formbuilder_setup (@) { #{{{
                }
                else {
                        # First time settings.
-                       $form->field(name => "name", size => 30);
+                       $form->field(name => "name");
                        if ($session->param("name")) {
                                $form->field(name => "name", value => $session->param("name"));
                        }
@@ -193,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");
                                }