public function processSubmitRevoke() { $user_id = Tools::getValue('user_id'); $social_customer = new FacebookCustomer(); if (!$social_customer->getByUserId($user_id)) { FSLTools::returnError(Tools::displayError('This Facebook user is not registered.')); } $notAuthorized = Tools::getValue('notAuthorized'); if (!($notAuthorized == 'on' || $notAuthorized == 'true' || $notAuthorized == '1')) { $facebookApi = $this->initApi(Tools::getValue('accessToken')); try { $facebookApi->delete('/' . $user_id . '/permissions'); } catch (Facebook\Exceptions\FacebookResponseException $e) { // When Graph returns an error FSLTools::returnError(Tools::displayError('Graph returned an error: ') . $e->getMessage()); } catch (Facebook\Exceptions\FacebookSDKException $e) { // When validation fails or other local issues FSLTools::returnError(Tools::displayError('Facebook SDK returned an error: ') . $e->getMessage()); } } return $social_customer; }
public function processSubmitRevoke($provider) { $social_customer = $this->socialNetworkList[$provider]->processSubmitRevoke(); if (!Validate::isLoadedObject($social_customer)) { FSLTools::returnError(Tools::displayError('Bad customer object.')); } $social_customer->delete(); FSLTools::returnAjax(Context::getContext()->link->getPageLink('my-account'), $social_customer); }
public function processSubmitRevoke() { $social_customer = new GoogleCustomer(); if (!$social_customer->getByUserId(Tools::getValue('user_id'))) { FSLTools::returnError(Tools::displayError('This Google user is not registered.')); } $notAuthorized = Tools::getValue('notAuthorized'); if (!($notAuthorized == 'on' || $notAuthorized == 'true' || $notAuthorized == '1')) { $googleClient = $this->initClient(Tools::getValue('accessToken')); try { $googleClient->revokeToken(); } catch (Google_Exception $e) { // When validation fails or other local issues FSLTools::returnError(sprintf(Tools::displayError('Google SDK returned an error: %s'), $e->getMessage())); } } return $social_customer; }