summaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin
diff options
context:
space:
mode:
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2007-05-17 08:06:05 +0000
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2007-05-17 08:06:05 +0000
commit739325834bd8252d94558d9662bc877c5f0d83af (patch)
tree47c1b5bfd39e7c73f2fc4066da780b61815d3301 /IkiWiki/Plugin
parent7717342db77a863a01590ee9beb144ae09b14a55 (diff)
* Fix some bugs in password handling:
- If the password is empty in preferences, don't clear the existing password. - Actually check the confirm password field, even if it's left empty.
Diffstat (limited to 'IkiWiki/Plugin')
-rw-r--r--IkiWiki/Plugin/passwordauth.pm27
1 files changed, 17 insertions, 10 deletions
diff --git a/IkiWiki/Plugin/passwordauth.pm b/IkiWiki/Plugin/passwordauth.pm
index 1520cea83..b61e6c86e 100644
--- a/IkiWiki/Plugin/passwordauth.pm
+++ b/IkiWiki/Plugin/passwordauth.pm
@@ -30,6 +30,17 @@ sub formbuilder_setup (@) { #{{{
$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) {
@@ -47,12 +58,6 @@ sub formbuilder_setup (@) { #{{{
if ($submittype eq "Create Account") {
$form->field(
- name => "confirm_password",
- validate => sub {
- shift eq $form->field("password");
- },
- );
- $form->field(
name => "account_creation_password",
validate => sub {
shift eq $config{account_creation_password};
@@ -120,13 +125,15 @@ sub formbuilder_setup (@) { #{{{
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");
- });
-
+ }),
}
}
@@ -197,7 +204,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)) {
+ if (defined $form->field($field) && length $form->field($field)) {
IkiWiki::userinfo_set($user_name, $field, $form->field($field)) ||
error("failed to set $field");
}