More work on password quality restrictions
authorJamie Cameron <jcameron@webmin.com>
Thu, 13 Sep 2007 06:33:54 +0000 (06:33 +0000)
committerJamie Cameron <jcameron@webmin.com>
Thu, 13 Sep 2007 06:33:54 +0000 (06:33 +0000)
change-user/change.cgi
change-user/lang/en

index eb84270..8521f12 100755 (executable)
@@ -14,6 +14,14 @@ if (!defined($oldtheme)) {
        $oldtheme = $gconfig{'theme'};
        }
 
+# Validate the password
+if ($access{'pass'} && &can_change_pass($user) && !$in{'pass_def'}) {
+       $in{'pass'} =~ /:/ && &error($text{'change_ecolon'});
+       $perr = &acl::check_password_restrictions(
+               $user->{'name'}, $in{'pass'});
+       &error(&text('change_epass', $perr)) if ($perr);
+       }
+
 print "$text{'change_user'}<br>\n";
 if ($access{'lang'}) {
        if ($in{'lang_def'}) {
@@ -35,11 +43,8 @@ if ($access{'theme'}) {
                $newtheme = $gconfig{'theme'};
                }
        }
-if ($access{'pass'} && &can_change_pass($user)) {
-       if (!$in{'pass_def'}) {
-               $in{'pass'} =~ /:/ && &error($text{'change_ecolon'});
-               $user->{'pass'} = &acl::encrypt_password($in{'pass'});
-               }
+if ($access{'pass'} && &can_change_pass($user) && !$in{'pass_def'}) {
+       $user->{'pass'} = &acl::encrypt_password($in{'pass'});
        }
 &acl::modify_user($user->{'name'}, $user);
 print "$text{'change_done'}<p>\n";
index 2ceca16..f1a35c0 100644 (file)
@@ -24,6 +24,7 @@ change_done=.. done
 change_restart=Re-starting Webmin ..
 change_redirect=Re-directing to main menu ..
 change_ecolon=Your password cannot contain the : character
+change_epass=New password is not valid : $1
 
 acl_lang=Can change language?
 acl_theme=Can change theme?