/** * Hook after the session has been initialized, but before processing the request. */ function hook_bootstrap() { if (!empty($_GET['rublon']) and $_GET['rublon'] == 'callback') { try { $rublon = new Rublon2Factor(RUBLON_SYSTEM_TOKEN, RUBLON_SECRET_KEY); $callback = new Rublon2FactorCallback($rublon); $callback->call($successHandler = function ($userId, Rublon2FactorCallback $callback) { // We are using the user's email instead a numeric ID: $_SESSION['user'] = $userId; }, $cancelHandler = function (Rublon2FactorCallback $callback) { die('Request canceled'); }); // If all ok, redirect to the main page: header('Location: ./'); exit; } catch (RublonException $e) { die($e->getMessage()); } } }
static function callbackSuccess(Rublon2FactorCallback $callback) { if ($action = $callback->getConsumerParam(self::PARAM_ACTION)) { if ($strategy = RublonConfirmStrategy::getStrategyInstance($action)) { $strategy->callbackSuccess($callback); } } }
function callbackSuccessNo(Rublon2FactorCallback $callback) { $url = $callback->getConsumerParam(RublonConfirmations::PARAM_FALLBACK_URL); RublonConfirmations::redirectParentFrame($url, $this->getAction(), __('Operation has been canceled.', 'rublon')); }