code: public function confirmEmailAction()
      {
          $token = $this->params()->fromRoute('token');
          if ($token) {
              $identity = $this->getUserService()->confirmEmail($token);
              if ($identity instanceof ResponseInterface) {
                  return $identity;
              } elseif ($identity) {
                  $viewModel = new ViewModel(compact('identity'));
                  $viewModel->setTemplate('cms-user/index/confirm-email');
                  return $viewModel;
              }
          }
  
          return $this->redirect()->toRoute($this->getOptions()->getDefaultUserRoute());
      }
docs: User email confirm action
  
  @return ResponseInterface|ViewModel