auth = $this->getDI()->get('auth'); } public function login() { $post = $this->request->getPost(); $validator = new AccountValidator(); $user = $validator->checkAdminLogin($post['account'], $post['password']); $validator->checkIfAllowLogin($user); $this->auth->saveAuthInfo($user); $this->loginHome($user); $this->eventsManager->fire('Account:afterLogin', $this, $user); } public function logout() { $user = $this->getLoginUser(); $this->auth->clearAuthInfo(); $this->eventsManager->fire('Account:afterLogout', $this, $user); } protected function loginHome($user) { $auth = new HomeAuth(); $auth->saveAuthInfo($user); } }