Exemple #1
0
 /**
  * Process massaction key
  *
  * @param \Magento\Backend\App\AbstractAction $subject
  * @param callable $proceed
  * @param \Magento\Framework\App\RequestInterface $request
  *
  * @return mixed
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function aroundDispatch(\Magento\Backend\App\AbstractAction $subject, \Closure $proceed, \Magento\Framework\App\RequestInterface $request)
 {
     $key = $request->getPost('massaction_prepare_key');
     if ($key) {
         $postData = $request->getPost($key);
         $value = is_array($postData) ? $postData : explode(',', $postData);
         $request->setPost($key, $value ? $value : null);
     }
     return $proceed($request);
 }
Exemple #2
0
 /**
  * Performs login, if user submitted login form
  *
  * @param \Magento\Framework\App\RequestInterface $request
  * @return bool
  */
 protected function _performLogin(\Magento\Framework\App\RequestInterface $request)
 {
     $outputValue = true;
     $postLogin = $request->getPost('login');
     $username = isset($postLogin['username']) ? $postLogin['username'] : '';
     $password = isset($postLogin['password']) ? $postLogin['password'] : '';
     $request->setPost('login', null);
     try {
         $this->_auth->login($username, $password);
     } catch (\Magento\Backend\Model\Auth\Exception $e) {
         if (!$request->getParam('messageSent')) {
             $this->messageManager->addError($e->getMessage());
             $request->setParam('messageSent', true);
             $outputValue = false;
         }
     }
     return $outputValue;
 }