【发布时间】:2022-09-24 01:37:43
【问题描述】:
我的RouteServiceProvider.php 中有一个自定义速率限制规则,看起来像这样;
protected function configureRateLimiting()
{
RateLimiter::for(\'example\', function (Request $request) {
return Limit::perHour(5)->by(optional($request->user())->id ?: $request->ip())->response(function () {
return response()->view(\'auth.login\', [
\'error\' =>
\'You have exceeded the maximum number of login attempts. \' .
\'Your account has been blocked for security reasons.\',
\'page\' => \'login\',
], 422);
});
});
}
这会在一小时内尝试 5 次后锁定用户。
我想在 2 次尝试后添加一个警告,例如 you have had two failed login attempts. If you continue entering an incorrect password your account will be locked.
这可能吗?我找不到有关此的任何信息。
干杯,