doujiu8145 2018-11-19 01:09
浏览 49
已采纳

Laravel 5.6更改电子邮件地址会重置登录限制

There's a weird issue with laravel's login throttling. I set the variables:

 public $maxAttempts = 5;
 public $decayMinutes = 3;

in the Auth/LoginController.php, and override the sendLockoutResponse function like this:

protected function sendLockoutResponse(Request $request) {
  $seconds = $this->limiter()->availableIn(
      $this->throttleKey($request)
  );

  $minutes = floor($seconds / 60);
  $seconds = $seconds % 60;

  return back()->with('authError', 'Wait ' . $minutes . ' minutes and ' . $seconds . ' seconds.');
}

When I try 5 failed login attempts using wrong credentials I can see the AuthError message on the page. And if I go on with the same e-mail address I continue to see seconds and minutes decrease. But if I change the e-mail the whole throttle gets reset. I still have 5 failed attempts to go.

My question is: if laravel determines a user's login attempts by IP address and uses cache to poll them, why changing the e-mail resets the login throttle?

PS my .env values are:

BROADCAST_DRIVER=log
CACHE_DRIVER=file
SESSION_DRIVER=file
SESSION_LIFETIME=120
SESSION_SECURE_COOKIE=false
QUEUE_DRIVER=database
  • 写回答

1条回答 默认 最新

  • dongyo1818 2018-11-19 01:20
    关注

    The Laravel docs share the details of the built in throttling

    https://laravel.com/docs/5.7/authentication#login-throttling

    as you can read the IP and email address combination is used to track login attempts

    I imagine so that if multiple users are logging in from the same IP they all do not get locked out/throttled

    You would need to change this to use ID or similar if you want it to act differently

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 2024-五一综合模拟赛
  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭