Exemplo n.º 1
0
 /**
  * Logs in an user
  *
  * @static
  *
  * @param callback $redirectCallback
  * @return mixed Array on success
  */
 function login($redirectCallback = null)
 {
     $aConf = $GLOBALS['_MAX']['CONF'];
     if (!is_callable($redirectCallback)) {
         // Set the default callback
         $redirectCallback = array('OA_Auth', 'checkRedirect');
     }
     if (call_user_func($redirectCallback)) {
         header('location: http://' . $aConf['webpath']['admin']);
         exit;
     }
     if (defined('OA_SKIP_LOGIN')) {
         return OA_Auth::getFakeSessionData();
     }
     if (OA_Auth::suppliedCredentials()) {
         $doUser = OA_Auth::authenticateUser();
         if (!$doUser) {
             sleep(3);
             OA_Auth::restart($GLOBALS['strUsernameOrPasswordWrong']);
         }
         return OA_Auth::getSessionData($doUser);
     }
     OA_Auth::restart();
 }