/** * Authorize customer on frontend. * * @param Customer $customer * @throws \Exception * @return void */ protected function authorize(Customer $customer) { $url = $_ENV['app_frontend_url'] . 'customer/account/login/'; $this->transport->write($url); $this->read(); $url = $_ENV['app_frontend_url'] . 'customer/account/loginPost/'; $data = ['login[username]' => $customer->getEmail(), 'login[password]' => $customer->getPassword(), 'form_key' => $this->formKey]; $this->transport->write($url, $data, CurlInterface::POST, ['Set-Cookie:' . $this->cookies]); $response = $this->read(); if (strpos($response, 'customer/account/login')) { throw new \Exception($customer->getFirstname() . ', cannot be logged in by curl handler!'); } }