diff options
author | Andreas Gohr <andi@splitbrain.org> | 2013-04-22 22:03:13 +0200 |
---|---|---|
committer | Andreas Gohr <andi@splitbrain.org> | 2013-04-22 22:03:13 +0200 |
commit | 1e52e72a2e603634696a9f6db2fae3daf1d821fa (patch) | |
tree | 1d0e88f6c7a831f091e4b759a690880933537108 | |
parent | 87945c0e9622dca02b441749b7ed54cc67801475 (diff) | |
download | rpg-1e52e72a2e603634696a9f6db2fae3daf1d821fa.tar.gz rpg-1e52e72a2e603634696a9f6db2fae3daf1d821fa.tar.bz2 |
fix expiry check for adLDAP version FS#2759
-rw-r--r-- | lib/plugins/authad/auth.php | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/lib/plugins/authad/auth.php b/lib/plugins/authad/auth.php index 5985cd18f..95a25c5af 100644 --- a/lib/plugins/authad/auth.php +++ b/lib/plugins/authad/auth.php @@ -218,22 +218,24 @@ class auth_plugin_authad extends DokuWiki_Auth_Plugin { // check expiry time if($info['expires'] && $this->conf['expirywarn']){ - $timeleft = $adldap->user()->passwordExpiry($user); // returns unixtime - $timeleft = round($timeleft/(24*60*60)); - $info['expiresin'] = $timeleft; - - // if this is the current user, warn him (once per request only) - if(($_SERVER['REMOTE_USER'] == $user) && - ($timeleft <= $this->conf['expirywarn']) && - !$this->msgshown - ) { - $msg = sprintf($lang['authpwdexpire'], $timeleft); - if($this->canDo('modPass')) { - $url = wl($ID, array('do'=> 'profile')); - $msg .= ' <a href="'.$url.'">'.$lang['btn_profile'].'</a>'; + $expiry = $adldap->user()->passwordExpiry($user); + if(is_array($expiry)){ + $info['expiresat'] = $expiry['expiryts']; + $info['expiresin'] = round(($info['expiresat'] - time())/(24*60*60)); + + // if this is the current user, warn him (once per request only) + if(($_SERVER['REMOTE_USER'] == $user) && + ($info['expiresin'] <= $this->conf['expirywarn']) && + !$this->msgshown + ) { + $msg = sprintf($lang['authpwdexpire'], $info['expiresin']); + if($this->canDo('modPass')) { + $url = wl($ID, array('do'=> 'profile')); + $msg .= ' <a href="'.$url.'">'.$lang['btn_profile'].'</a>'; + } + msg($msg); + $this->msgshown = true; } - msg($msg); - $this->msgshown = true; } } |