예제 #1
0
 protected function login_google($user, $email, $password, $captcha, $captcha_token)
 {
     $this->load->library('GoogleDomain');
     try {
         $auth_response = GoogleDomain::authenticate($email, $password, $captcha, $captcha_token);
         if (OpenVBX::schemaVersion() >= 24) {
             // Login succeeded
             try {
                 $user->setting_set('last_login', new MY_ModelLiteral('UTC_TIMESTAMP()'));
             } catch (VBX_UserException $e) {
                 $this->error_message('login', $e->getMessage());
                 return FALSE;
             }
         }
     } catch (GoogleDomainException $e) {
         $this->error_message('login', $e->getMessage());
         return FALSE;
     }
     return $user;
 }
예제 #2
0
 public function appsync()
 {
     $this->load->library('GoogleDomain');
     $api_key = $this->input->post('email');
     $api_secret = $this->input->post('password');
     $users = array();
     $groups = array();
     $message = '';
     $error = false;
     try {
         $users = GoogleDomain::get_users($api_key, $api_secret);
         $groups = GoogleDomain::get_groups($api_key, $api_secret);
     } catch (GoogleDomainException $e) {
         $error = true;
         $message = $e->getMessage();
     }
     $data['json'] = array('error' => $error, 'message' => $message, 'users' => $users, 'groups' => $groups);
     $this->respond('', 'accounts', $data);
 }