Beispiel #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->getUserByTwitterId($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("Twitter ID {$user_profile->id} sucessfully authorised, but must register locally", 'ok', 1);
         //forward to registration
         $this->mapUserToOnxshop($user_profile);
         onxshopGoTo("/page/13");
         //TODO get node_id from conf
     }
 }