as the timestamp used for ldap is not the unixtimestamp, we just use time for updating the session cache on auth_alpwchange_val

This commit is contained in:
Klaus Leithoff 2011-09-23 11:10:05 +00:00
parent ac22466ba0
commit 53c78cd9e2
2 changed files with 6 additions and 4 deletions

View File

@ -164,8 +164,8 @@ class auth
elseif ($passwordAgeBorder > $alpwchange_val && $alpwchange_val > 0) elseif ($passwordAgeBorder > $alpwchange_val && $alpwchange_val > 0)
{ {
error_log(__METHOD__.' Password of '.$GLOBALS['egw_info']['user']['account_lid'].' ('.$GLOBALS['egw_info']['user']['account_fullname'].') is of old age.'.array2string(array( error_log(__METHOD__.' Password of '.$GLOBALS['egw_info']['user']['account_lid'].' ('.$GLOBALS['egw_info']['user']['account_fullname'].') is of old age.'.array2string(array(
'ts'=>$GLOBALS['egw_info']['user']['account_lastpwd_change'], 'ts'=> $alpwchange_val,
'date'=>egw_time::to($GLOBALS['egw_info']['user']['account_lastpwd_change'])))); 'date'=>egw_time::to($alpwchange_val))));
$message = lang('it has been more then %1 days since you changed your password',$GLOBALS['egw_info']['server']['change_pwd_every_x_days']); $message = lang('it has been more then %1 days since you changed your password',$GLOBALS['egw_info']['server']['change_pwd_every_x_days']);
} }
if ($GLOBALS['egw_info']['user']['apps']['password']) egw::redirect_link('/preferences/password.php',array('message'=>$message)); if ($GLOBALS['egw_info']['user']['apps']['password']) egw::redirect_link('/preferences/password.php',array('message'=>$message));

View File

@ -245,7 +245,8 @@ class auth_ldap implements auth_backend
{ {
return false; return false;
} }
if (!$admin) egw_cache::setSession('phpgwapi','auth_alpwchange_val',$entry['shadowlastchange']); // using time() is sufficient to represent the current time, we do not need the timestamp written to the storage
if (!$admin) egw_cache::setSession('phpgwapi','auth_alpwchange_val',(is_null($lastpwdchange) || $lastpwdchange<0 ? time():$lastpwdchange));
return true; return true;
} }
@ -300,7 +301,8 @@ class auth_ldap implements auth_backend
if($old_passwd) // if old password given (not called by admin) update the password in the session if($old_passwd) // if old password given (not called by admin) update the password in the session
{ {
$GLOBALS['egw']->session->appsession('password','phpgwapi',$new_passwd); $GLOBALS['egw']->session->appsession('password','phpgwapi',$new_passwd);
egw_cache::setSession('phpgwapi','auth_alpwchange_val',$entry['shadowlastchange']); // using time() is sufficient to represent the current time, we do not need the timestamp written to the storage
egw_cache::setSession('phpgwapi','auth_alpwchange_val',time());
} }
return $entry['userpassword']; return $entry['userpassword'];
} }