From 77b6225ed6a3dcbfb83ae4403306740e4d0d6b00 Mon Sep 17 00:00:00 2001 From: Jamie Cameron Date: Thu, 13 Sep 2007 06:33:54 +0000 Subject: [PATCH] More work on password quality restrictions --- change-user/change.cgi | 15 ++++++++++----- change-user/lang/en | 1 + 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/change-user/change.cgi b/change-user/change.cgi index eb84270e5..8521f12e3 100755 --- a/change-user/change.cgi +++ b/change-user/change.cgi @@ -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'}
\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'}

\n"; diff --git a/change-user/lang/en b/change-user/lang/en index 2ceca1687..f1a35c0ea 100644 --- a/change-user/lang/en +++ b/change-user/lang/en @@ -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?