I'm working on a website , in CV part users have some articles that only logged in users can download. I want to make changes to the login Action or preDispatch() to set session for guest users to download the articles.
Can someone tell me how it can be done or give me some reference links?
Here is my preDispatch():
public function preDispatch()
{
$userInfo=$this->_auth->getStorage()->read();
$identity= $this->_auth->getIdentity();
if(!$this->_auth->hasIdentity())
{
return $this->_helper->redirector('login','login');
}
if(!isset($userInfo["member_id"]) || strlen($userInfo["member_id"])==0)
{
return $this->_helper->redirector('forbidden','login');
}
$this->_accessType=2;
}