function pluginsLoaded()
 {
     parent::pluginsLoaded();
     if ($this->isTheAction()) {
         if ($data = RublonConfirmations::popStoredData($this->getAction())) {
             $this->restoreContext($data['context']);
             RublonConfirmations::$dataRestored = true;
         }
     }
 }
Exemplo n.º 2
0
 function checkForAction()
 {
     global $pagenow;
     if ($this->isTheAction() and !empty($_POST) and ($pagenow == 'profile.php' or !empty($_POST['user_id']))) {
         $userId = empty($_POST['user_id']) ? get_current_user_id() : $_POST['user_id'];
         if ($user = get_userdata($userId)) {
             $this->setUser($user);
             $old = array('email' => $user->user_email, RublonHelper::FIELD_USER_PROTECTION_TYPE => RublonHelper::userProtectionType($user));
             $new = array('email' => $_POST['email'], RublonHelper::FIELD_USER_PROTECTION_TYPE => empty($_POST[RublonHelper::FIELD_USER_PROTECTION_TYPE]) ? null : $_POST[RublonHelper::FIELD_USER_PROTECTION_TYPE]);
             RublonConfirmations::handleConfirmation($this->getAction(), $_POST, $old, $new);
         }
     }
 }
Exemplo n.º 3
0
 static function confirm(RublonConfirmStrategy $strategy, $dataKey)
 {
     try {
         $rublon = RublonHelper::getRublon();
         $authUrl = $rublon->confirm(RublonHelper::getActionURL('confirm'), RublonHelper::getUserId(), RublonHelper::getUserEmail(), $strategy->getConfirmMessage(), self::getConfirmParams($strategy, $dataKey));
     } catch (ForbiddenMethod_RublonAPIException $e) {
         RublonConfirmations::abortConfirmation('FORBIDDEN_METHOD');
     } catch (RublonException $e) {
         // 			echo $e->getClient()->getRawRequest();exit;
         RublonHelper::_handleCallbackException($e);
         RublonConfirmations::abortConfirmation('API_ERROR');
     }
     if (!empty($authUrl)) {
         wp_redirect($authUrl);
         exit;
     } else {
         // Why empty?
         if ($roleProtectionType == RublonHelper::PROTECTION_TYPE_MOBILE) {
             // Mobile App is required:
             RublonConfirmations::abortConfirmation('MOBILE_APP_REQUIRED');
         } else {
             // Rublon is not working at this moment or user is not protected:
             self::redirectParentFrame($_SERVER['REQUEST_URI'], $strategy->getAction(), __('Please wait.', 'rublon'), $dataKey);
         }
     }
 }
Exemplo n.º 4
0
function rublon2factor_render_confirmations()
{
    echo '<p class="rublon-settings-desc">' . __('Choose operations which will be protected by the additional confirmation using Rublon.', 'rublon') . '</p>';
    if (RublonFeature::checkFeature(RublonAPIGetAvailableFeatures::FEATURE_OPERATION_CONFIRMATION)) {
        $settings = RublonConfirmations::getSettings();
        echo '<div class="rublon-settings-confirmations">';
        $actions = RublonConfirmations::getUIActions();
        foreach ($actions as $key => $action) {
            printf('<label><input type="checkbox" name="%s[]" value="%s"%s /> %s</label>', RublonHelper::RUBLON_CONFIRMATIONS_SETTINGS_KEY, $key, checked(true, in_array($key, $settings), false), __($action, 'rublon'));
        }
        echo '</div>';
    } else {
        echo '<p class="rublon-settings-desc rublon-inactive-feature"><span class="dashicons dashicons-shield-alt"></span>' . __('This feature is available only for the Rublon Business Edition premium users.', 'rublon') . '</p>';
    }
}
Exemplo n.º 5
0
 function isConfirmationRequired()
 {
     return RublonFeature::checkFeature(RublonAPIGetAvailableFeatures::FEATURE_OPERATION_CONFIRMATION) and (!$this->hasAdminUI() or in_array($this->getAction(), RublonConfirmations::getSettings()));
 }