Ejemplo n.º 1
0
/**
 * 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());
        }
    }
}
Ejemplo n.º 2
0
 static function callbackSuccess(Rublon2FactorCallback $callback)
 {
     if ($action = $callback->getConsumerParam(self::PARAM_ACTION)) {
         if ($strategy = RublonConfirmStrategy::getStrategyInstance($action)) {
             $strategy->callbackSuccess($callback);
         }
     }
 }
Ejemplo n.º 3
0
 function callbackSuccessNo(Rublon2FactorCallback $callback)
 {
     $url = $callback->getConsumerParam(RublonConfirmations::PARAM_FALLBACK_URL);
     RublonConfirmations::redirectParentFrame($url, $this->getAction(), __('Operation has been canceled.', 'rublon'));
 }