code: public function afterLogin()
      {
          $this->csrf->removeTokens();
  
          // Migrate session to a new ID to prevent fixation
          $this->session->migrate(true);
          
          // Set authentication information
          $this->session->set('user', serialize($this->user));
  
          $this->logger->info(
              "Login: {id} ({name}) via {method} from {addr}",
              array(
                  "id" => $this->user->getId(),
                  "name" => $this->user->getDisplayName(),
                  "method" => $this->user->getAuthenticator(),
                  "addr" => $_SERVER['REMOTE_ADDR']
              )
          );
          
          $this->triggerEvent("afterLogin", [$this->user]);
  
          $afterLogin = Utils::getRefererQueryParam($this->request->headers->get("referer"), "afterLogin");
          if ($afterLogin && Utils::isValidPageId($afterLogin)) {
              $this->redirectToPage($afterLogin);
          } elseif ($this->session->has("afterLogin")) {
              $page = $this->session->get("afterLogin");
              $this->session->remove("afterLogin");
              $this->redirectToPage($page);
          }
  
          //default redirect after login
          $this->redirectToPage($this->config["afterLogin"]);
      }
docs: {@inheritdoc}