diff --git a/lam/HISTORY b/lam/HISTORY index e3779732..4ec37c0a 100644 --- a/lam/HISTORY +++ b/lam/HISTORY @@ -1,4 +1,5 @@ 6.8 + - Windows: added home drive and force password change to profile editor - LAM Pro: -> Bind DLZ: entry table can show record data (use special attribute "#records" in server profile) - Fixed bugs: diff --git a/lam/lib/modules/windowsUser.inc b/lam/lib/modules/windowsUser.inc index 07dbfcd7..0b93624f 100644 --- a/lam/lib/modules/windowsUser.inc +++ b/lam/lib/modules/windowsUser.inc @@ -2820,6 +2820,9 @@ class windowsUser extends baseModule implements passwordService { } $driveSelect = new htmlResponsiveSelect('windowsUser_homeDrive', $drives, array('-'), _('Home drive'), 'homeDrive'); $return->add($driveSelect, 12); + // force password change + $passwordChangeCheckbox = new htmlResponsiveInputCheckbox('windowsUser_pwdMustChange', true, _('Password change at next login'), 'pwdMustChange'); + $return->add($passwordChangeCheckbox, 12); return $return; } @@ -2879,6 +2882,18 @@ class windowsUser extends baseModule implements passwordService { $oList = preg_split('/;[ ]*/', $profile['windowsUser_o'][0]); $this->attributes['o'] = $oList; } + // force password change + if (isset($profile['windowsUser_pwdMustChange'][0]) && ($profile['windowsUser_pwdMustChange'][0] == "true")) { + $this->attributes['pwdLastSet'][0] = '0'; + } + elseif (isset($profile['windowsUser_pwdMustChange'][0]) && ($profile['windowsUser_pwdMustChange'][0] == "false")) { + if (isset($this->orig['pwdLastSet'][0]) && ($this->orig['pwdLastSet'][0] !== '0')) { + $this->attributes['pwdLastSet'][0] = $this->orig['pwdLastSet'][0]; + } + else { + $this->attributes['pwdLastSet'][0] = '-1'; + } + } } /**