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("");
+
+ $form->field(name => "confirm_password",
+ validate => sub {
+ shift eq $form->field("password");
+ },
+ );
+ $form->field(name => "password",
+ validate => sub {
+ shift eq $form->field("confirm_password");
+ },
+ );
}
if ($form->submitted) {
if ($submittype eq "Create Account") {
$form->field(
- name => "confirm_password",
+ name => "account_creation_password",
validate => sub {
- shift eq $form->field("password");
+ shift eq $config{account_creation_password};
},
- );
+ required => 1,
+ ) if (length $config{account_creation_password});
$form->field(
name => "email",
validate => "EMAIL",
value => $session->param("name"), force => 1,
fieldset => "login");
$form->field(name => "password", type => "password",
- fieldset => "login");
+ fieldset => "login",
+ validate => sub {
+ shift eq $form->field("confirm_password");
+ }),
$form->field(name => "confirm_password", type => "password",
fieldset => "login",
validate => sub {
shift eq $form->field("password");
- });
-
+ }),
}
}
if ($form->submitted eq "Save Preferences" && $form->validate) {
my $user_name=$form->field('name');
foreach my $field (qw(password)) {
- if (defined $form->field($field)) {
+ if (defined $form->field($field) && length $form->field($field)) {
IkiWiki::userinfo_set($user_name, $field, $form->field($field)) ||
error("failed to set $field");
}
}
}
}
-
- IkiWiki::printheader($session);
- print IkiWiki::misctemplate($form->title, $form->render(submit => $buttons));
} #}}}
1