Ejemplo n.º 1
0
 /**
  * loginToOnxshop
  */
 public function loginToOnxshop($user_profile)
 {
     require_once 'models/client/client_customer.php';
     $Customer = new client_customer();
     $Customer->setCacheable(false);
     if ($customer_detail = $Customer->getUserByFacebookId($user_profile['id'])) {
         // already exists a valid account, we can login
         msg("{$customer_detail['email']} is already registered", 'ok', 1);
         $_SESSION['client']['customer'] = $customer_detail;
         $_SESSION['use_page_cache'] = false;
         // auto login (TODO allow to enable/disable this behaviour)
         $Customer->generateAndSaveOnxshopToken($customer_detail['id']);
     } else {
         msg("{$user_profile['email']} (FB ID {$user_profile['id']}) successfully authorised over Facebook, but must register locally", 'ok', 1);
         //forward to registration
         $this->mapUserToOnxshop($user_profile);
         onxshopGoTo("/page/13");
         //TODO get node_id from common_node.conf
     }
 }