蜜罐代码点火器 4

Honeypot Codeigniter 4

如何在 Codeigniter 4 中捕获蜜罐异常?

我模拟了bot,所以honeypot的字段被填满了。但是 CI4 立即抛出异常。我想将该访问记录到我的数据库中,并希望重定向到程序正在为该用户设置睡眠功能的“监狱”站点。因此,每次尝试他都必须等待更长的时间才能得到答案。

有什么建议吗?

我得到的当前异常: CodeIgniter\Honeypot\Exceptions\HoneypotException#3 Honeypot.theClientIsABot

 * @return void
 */
 public function before(RequestInterface $request, $arguments = null)
 {
      $honeypot = Services::honeypot(new \Config\Honeypot());
      if ($honeypot->hasContent($request))
      {
          throw HoneypotException::isBot();
      }
  }

已显示此信息。

系统中启用了蜜罐。蜜罐的配置文件只是让你配置输入字段本身。不是 'what should happen if honeypot isset'.

我的 .env 文件:

honeypot.hidden     = 'true'
honeypot.label      = 'What is 12 + 2?'
honeypot.name       = 'answer'
honeypot.template   = '<label>{label}</label><input type="text" id=" 
{name}" name="{name}" value=""/>'
honeypot.container  = '<div style="display:none">{template}</div>'

来自 Codeigniter 4 的信息: https://codeigniter.com/user_guide/libraries/honeypot.html#customizing-honeypot

我更改了系统文件夹和蜜罐之前正常抛出异常的功能。我在那里发现了异常,并在那里设置了重定向。这不是最好的解决方案,因为当 CI 4 有更新时,它将被覆盖。