fix(auth): enforce password and agent role boundaries

This commit is contained in:
wchino
2026-07-21 23:41:18 +08:00
parent fb15c64d9b
commit 457d2cc9e5
7 changed files with 135 additions and 19 deletions

View File

@@ -10,7 +10,6 @@ use Illuminate\Cache\RateLimiting\Limit;
use Illuminate\Support\Facades\RateLimiter;
use App\Services\Wallet\MainSiteWalletGateway;
use App\Services\Wallet\HttpMainSiteWalletGateway;
use App\Services\Wallet\StubMainSiteWalletGateway;
final class AppServiceProvider extends ServiceProvider
{
@@ -81,5 +80,15 @@ final class AppServiceProvider extends ServiceProvider
return Limit::perMinute(15)->by($request->ip());
});
RateLimiter::for('player-password-change', function (Request $request) {
if ((bool) env('LOTTERY_E2E', false)) {
return Limit::none();
}
$playerId = $request->lotteryPlayer()?->getKey();
return Limit::perMinute(5)->by(($playerId ?? 'guest').'|'.$request->ip());
});
}
}