Logout.php 889 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. /**
  3. *
  4. * Copyright © Magento, Inc. All rights reserved.
  5. * See COPYING.txt for license details.
  6. */
  7. namespace Magento\Backend\Controller\Adminhtml\Auth;
  8. use Magento\Framework\App\Action\HttpGetActionInterface as HttpGet;
  9. use Magento\Framework\App\Action\HttpPostActionInterface as HttpPost;
  10. class Logout extends \Magento\Backend\Controller\Adminhtml\Auth implements HttpGet, HttpPost
  11. {
  12. /**
  13. * Administrator logout action
  14. *
  15. * @return \Magento\Backend\Model\View\Result\Redirect
  16. */
  17. public function execute()
  18. {
  19. $this->_auth->logout();
  20. $this->messageManager->addSuccessMessage(__('You have logged out.'));
  21. /** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */
  22. $resultRedirect = $this->resultRedirectFactory->create();
  23. return $resultRedirect->setPath($this->_helper->getHomePageUrl());
  24. }
  25. }