Ejemplo n.º 1
0
 private function isAccountBlockedByLatch()
 {
     $userId = $this->retrieveUserId();
     $latchId = LatchHelper::getLatchId($userId);
     if ($latchId != NULL) {
         $status = $this->getLatchStatus($latchId);
         if (isset($status['twoFactor'])) {
             JFactory::getSession()->set("latch_twoFactor", $status['twoFactor']);
             $this->loadTwoFactorForm();
         } else {
             return $status['accountBlocked'];
         }
     }
     return false;
 }
Ejemplo n.º 2
0
//JFactory::getDocument()->addStyleSheet(JUri::root() . "modules/mod_latch/latch.css");
JHtml::stylesheet('mod_latch/latch.css', false, true, false);
// Generate all the variables needed in the view
$user = JFactory::getUser();
$application = JFactory::getApplication();
$input = $application->input;
$latchAction = $input->get("latchAction", false);
$pairingToken = $input->get("pairingToken", false);
$userWantsToPairAccount = $latchAction == "pair";
if ($pairingToken) {
    JSession::checkToken() or die('Invalid Token');
    if (LatchHelper::pair($pairingToken)) {
        $application->enqueueMessage('Account paired successfully.');
    } else {
        $application->enqueueMessage('Error pairing account.', 'warning');
    }
} elseif ($latchAction) {
    JSession::checkToken() or die('Invalid Token');
    if ($latchAction == "pair") {
        $userWantsToPairAccount = true;
    } elseif ($latchAction == "unpair") {
        if (!LatchHelper::unpair()) {
            $application->enqueueMessage('Error unpairing account.', 'warning');
        } else {
            $application->enqueueMessage('Account unpaired successfully.');
        }
    }
}
$paired = LatchHelper::getLatchId($user->id) != NULL;
// Load the view
require JPATH_ROOT . "/modules/mod_latch/tmpl/default.php";