-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathTicket.php
44 lines (40 loc) · 1.3 KB
/
Ticket.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
namespace Foggyline\Helpdesk\Controller;
abstract class Ticket extends \Magento\Framework\App\Action\Action
{
/**
* Customer session
*
* @var \Magento\Customer\Model\Session
*/
protected $customerSession;
/**
* @param \Magento\Framework\App\Action\Context $context
* @param \Magento\Customer\Model\Session $customerSession
* @param \Magento\Framework\View\Result\PageFactory $resultPageFactory
*/
public function __construct(
\Magento\Framework\App\Action\Context $context,
\Magento\Customer\Model\Session $customerSession
)
{
$this->customerSession = $customerSession;
parent::__construct($context);
}
/**
* Check customer authentication for some actions
*
* @param \Magento\Framework\App\RequestInterface $request
* @return \Magento\Framework\App\ResponseInterface
*/
public function dispatch(\Magento\Framework\App\RequestInterface $request)
{
if (!$this->customerSession->authenticate()) {
$this->_actionFlag->set('', 'no-dispatch', true);
if (!$this->customerSession->getBeforeUrl()) {
$this->customerSession->setBeforeUrl($this->_redirect->getRefererUrl());
}
}
return parent::dispatch($request);
}
}