diff --git a/op/op.UsrMgr.php b/op/op.UsrMgr.php index 70029a17b..861646a4c 100644 --- a/op/op.UsrMgr.php +++ b/op/op.UsrMgr.php @@ -194,6 +194,10 @@ else if ($action == "edituser") { $login = $_POST["login"]; $pwd = $_POST["pwd"]; + if(isset($_POST['clearpwd']) && $_POST['clearpwd']) + $clearpwd = 1; + else + $clearpwd = 0; if(isset($_POST["pwdexpiration"])) $pwdexpiration = $_POST["pwdexpiration"]; else @@ -209,25 +213,28 @@ else if ($action == "edituser") { $isHidden = (isset($_POST["ishidden"]) && $_POST["ishidden"]==1 ? 1 : 0); $isDisabled = (isset($_POST["isdisabled"]) && $_POST["isdisabled"]==1 ? 1 : 0); - if ($editedUser->getLogin() != $login) - $editedUser->setLogin($login); - if($pwdexpiration) - $editedUser->setPwdExpiration($pwdexpiration); if (isset($pwd) && ($pwd != "")) { if($settings->_passwordStrength) { $ps = new Password_Strength(); - $ps->set_password($_POST["pwd"]); + $ps->set_password($pwd); if($settings->_passwordStrengthAlgorithm == 'simple') $ps->simple_calculate(); else $ps->calculate(); $score = $ps->get_score(); - if($score >= $settings->_passwordStrength) { - $editedUser->setPwd(md5($pwd)); - } else { + if($score < $settings->_passwordStrength) { UI::exitError(getMLText("set_password"),getMLText("password_strength_insuffient")); } - } else { + } + } + if ($editedUser->getLogin() != $login) + $editedUser->setLogin($login); + if($pwdexpiration) + $editedUser->setPwdExpiration($pwdexpiration); + if(($role == SeedDMS_Core_User::role_guest) && $clearpwd) { + $editedUser->setPwd(''); + } else { + if (isset($pwd) && ($pwd != "")) { $editedUser->setPwd(md5($pwd)); } } diff --git a/views/bootstrap/class.UsrMgr.php b/views/bootstrap/class.UsrMgr.php index 52cf8e75c..5ade567f7 100644 --- a/views/bootstrap/class.UsrMgr.php +++ b/views/bootstrap/class.UsrMgr.php @@ -194,7 +194,7 @@ $(document).ready( function() { : - " name="pwd" id="pwd"> + " name="pwd" id="pwd">isGuest()) echo ' '.getMLText('clear_password'); ?> 0) {