Esempio n. 1
0
    $edition = 'free';
}
$template_style_id = JRequest::getInt('template_style_id', 0, 'GET');
$task = JRequest::getWord('task', '', 'POST');
$login_identifier = md5('state_update_login_' . strtolower($template_manifest['full_name']));
$customer_info_identifier = md5('state_update_customer_info_' . strtolower($template_manifest['full_name']));
$authentication = false;
$login = false;
switch ($task) {
    case 'login':
        JRequest::checkToken() or jexit('Invalid Token');
        $post = JRequest::get('post');
        $username = JRequest::getVar('username', '', 'post', 'username');
        $password = JRequest::getString('password', '', 'post', JREQUEST_ALLOWRAW);
        $login = $obj_updater_helper->login($username, $password);
        $canDo = $obj_updater_helper->getUserActions();
        if ($login && $canDo->get('core.manage')) {
            if ($edition != 'free') {
                $authentication = $obj_updater_helper->authenticateCustomerInfo();
                if ($authentication) {
                    $customer_password = JRequest::getString('customer_password', '', 'post', JREQUEST_ALLOWRAW);
                    $customer_info = array('username' => $post['customer_username'], 'password' => $customer_password);
                    $session->set($login_identifier, true, 'jsntemplatesession');
                    $session->set($customer_info_identifier, $customer_info, 'jsntemplatesession');
                }
            } else {
                $customer_info = array('username' => '', 'password' => '');
                $session->set($login_identifier, true, 'jsntemplatesession');
                $session->set($customer_info_identifier, $customer_info, 'jsntemplatesession');
                $authentication = true;
            }