Example #1
0
 /**
  * Sets up a user after successful authentication and session setup
  *
  * @returns bool Was the login successful
  */
 protected function userAfterAuthenticate($userId, $oauthServer)
 {
     $valid = false;
     if (!empty($GLOBALS['current_user'])) {
         $valid = true;
         $GLOBALS['logic_hook']->call_custom_logic('', 'after_load_user');
     }
     if ($GLOBALS['current_user']->status == 'Inactive' || $GLOBALS['current_user']->deleted == true) {
         $valid = false;
     }
     if ($valid) {
         SugarApplication::trackLogin();
         // Setup visibility where needed
         $oauthServer->setupVisibility();
         LogicHook::initialize()->call_custom_logic('', 'after_session_start');
         $this->user = $GLOBALS['current_user'];
         $this->user->setupSession();
     }
     return $valid;
 }