function login() { $userName = \Yoda\Request::getString('username'); $password = \Yoda\Request::getString('password'); $testMode = \Yoda\Request::getBool('test_mode'); try { APIHelper::setupClient($userName, $password, $testMode); $details = new ApiDetails(); } catch (SoapFault $e) { $this->redirect('index.php?controller=authorize', 'Error: (' . $e->faultcode . ') ' . $e->faultstring, 'error'); } catch (Exception $e) { $this->redirect('index.php?controller=authorize', $e->getMessage(), 'error'); } $_SESSION['username'] = $userName; $_SESSION['resellerKey'] = $password; $_SESSION['isTestMode'] = $testMode; $_SESSION['reseller_id'] = $details->getResellerId(); $this->redirect('index.php'); }
static function setupAPIClient() { return APIHelper::setupClient($_SESSION['username'], $_SESSION['resellerKey'], $_SESSION['isTestMode']); }