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 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3