45 parent::__construct($context);
58 if (0 == $this->
getRequest()->getPost(
'generate_random')) {
59 $key = $this->
getRequest()->getPost(
'crypt_key');
61 throw new \Exception(
__(
'Please enter an encryption key.'));
63 $this->encryptor->validateKey($key);
66 $newKey = $this->change->changeEncryptionKey($key);
67 $this->messageManager->addSuccessMessage(
__(
'The encryption key has been changed.'));
70 $this->messageManager->addNoticeMessage(
72 'This is your new encryption key: %1. ' .
73 'Be sure to write it down and take good care of it!',
78 $this->cache->clean();
79 }
catch (\Exception $e) {
80 $this->messageManager->addErrorMessage($e->getMessage());
81 $this->_session->setFormData([
'crypt_key' => $key]);
_redirect($path, $arguments=[])
__construct(\Magento\Backend\App\Action\Context $context, \Magento\Framework\Encryption\EncryptorInterface $encryptor, \Magento\EncryptionKey\Model\ResourceModel\Key\Change $change, \Magento\Framework\App\CacheInterface $cache)