Esempio n. 1
0
 public function verify($credentials)
 {
     global $aecConfig;
     $savetask = '';
     if (isset($_REQUEST['task'])) {
         $_REQUEST['task'] = '';
         $savetask = $_REQUEST['task'];
     }
     $_REQUEST['task'] = $savetask;
     if (!$aecConfig->cfg['require_subscription']) {
         return true;
     }
     $verification = AECToolbox::VerifyUser($credentials['username']);
     if ($verification === true) {
         return true;
     } else {
         define('AEC_AUTH_ERROR_MSG', $verification);
         define('AEC_AUTH_ERROR_UNAME', $credentials['username']);
         $v = new JVersion();
         if ($v->isCompatible('3.0')) {
             $this->onUserLoginFailure(null);
         }
         return false;
     }
 }
Esempio n. 2
0
 static function VerifyMetaUser($metaUser)
 {
     global $aecConfig;
     if (!$aecConfig->cfg['require_subscription']) {
         return true;
     }
     if ($metaUser->hasSubscription) {
         $result = $metaUser->objSubscription->verify($metaUser);
         if ($result == 'expired' || $result == 'pending') {
             $metaUser->setTempAuth();
         }
         return $result;
     }
     if (!empty($aecConfig->cfg['entry_plan'])) {
         $payment_plan = new SubscriptionPlan();
         $payment_plan->load($aecConfig->cfg['entry_plan']);
         $metaUser->establishFocus($payment_plan, 'free', false);
         $metaUser->focusSubscription->applyUsage($payment_plan->id, 'free', 1, 0);
         return AECToolbox::VerifyUser($metaUser->cmsUser->username);
     } else {
         $invoices = aecInvoiceHelper::InvoiceCountbyUserID($metaUser->userid);
         $metaUser->setTempAuth();
         if ($invoices) {
             $invoice = aecInvoiceHelper::lastUnclearedInvoiceIDbyUserID($metaUser->userid);
             if ($invoice) {
                 return 'open_invoice';
             }
         }
         return 'subscribe';
     }
 }