Example #1
0
 static function loginAndCheckExpired()
 {
     global $ui, $config, $plist, $message, $smarty;
     /* Remove all locks of this user */
     del_user_locks($ui->dn);
     /* Save userinfo and plugin structure */
     session::global_set('ui', $ui);
     /* User might have its own language, re-run initLanguage */
     initLanguage();
     /* Save config to session. */
     session::global_set('config', $config);
     /* We need a fully loaded plist and config to test account expiration */
     session::global_un_set('plist');
     $plist = load_plist();
     /* Check account expiration */
     if ($config->get_cfg_value('handleExpiredAccounts') == 'TRUE') {
         $expired = $ui->expired_status();
         if ($expired == POSIX_ACCOUNT_EXPIRED) {
             new log('security', 'login', '', array(), 'Account for user "' . self::$username . '" has expired');
             $message = _('Account locked. Please contact your system administrator!');
             $smarty->assign('nextfield', 'password');
             return FALSE;
         }
     }
     return TRUE;
 }
Example #2
0
 */
/* Basic setup, remove eventually registered sessions */
require_once "../include/php_setup.inc";
require_once "functions.inc";
header("Content-type: text/html; charset=UTF-8");
/* try to start session, so we can remove userlocks, 
  if the old session is still available */
@session::start();
session::set('errorsAlreadyPosted', array());
if (session::global_is_set('ui')) {
    /* Get config & ui informations */
    $ui = session::global_get("ui");
    /* config used for del_user_locks & some lines below to detect the language */
    $config = session::global_get("config");
    /* Remove all locks of this user */
    del_user_locks($ui->dn);
    /* Write something to log */
    new log("security", "logout", "", array(), "A user logged out");
}
/* Language setup */
if (!isset($config) || $config->get_cfg_value("core", "language") == "") {
    $lang = get_browser_language();
} else {
    $lang = $config->get_cfg_value("core", "language");
}
// Try to keep track of logouts, this will fail if our session has already expired.
// Nothing will be logged if config isn't present anymore.
stats::log('global', 'global', array(), $action = 'logout', $amount = 1, 0);
putenv("LANGUAGE=");
putenv("LANG={$lang}");
setlocale(LC_ALL, $lang);