Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Auth.php
Go to the documentation of this file.
1 <?php
7 
9 
13 class Auth
14 {
18  protected $sessionsManager;
19 
23  protected $messageManager;
24 
29  public function __construct(
31  \Magento\Framework\Message\ManagerInterface $messageManager
32  ) {
33  $this->sessionsManager = $sessionsManager;
34  $this->messageManager = $messageManager;
35  }
36 
42  public function afterLogin(\Magento\Backend\Model\Auth $authModel)
43  {
44  $this->sessionsManager->processLogin();
45  if ($this->sessionsManager->getCurrentSession()->isOtherSessionsTerminated()) {
46  $this->messageManager->addWarning(__('All other open sessions for this account were terminated.'));
47  }
48  }
49 
55  public function beforeLogout(\Magento\Backend\Model\Auth $authModel)
56  {
57  $this->sessionsManager->processLogout();
58  }
59 }
__()
Definition: __.php:13
afterLogin(\Magento\Backend\Model\Auth $authModel)
Definition: Auth.php:42
__construct(AdminSessionsManager $sessionsManager, \Magento\Framework\Message\ManagerInterface $messageManager)
Definition: Auth.php:29
beforeLogout(\Magento\Backend\Model\Auth $authModel)
Definition: Auth.php:55