code: protected function checkLogoutSubmission()
      {
          $post = $this->request->request;
          if ($post->has("logout")) {
              if (!$this->isValidCSRF($post->get("csrf_token"), self::LOGOUT_CSRF_ACTION)) {
                  $this->redirectToPage("logout");
              }
              $this->logout();
          }
      }
docs: Checks the current request for logout action