Fix captcha rendering and refresh rate limit

This commit is contained in:
biss committed 2026-09-29 11:02:42 +08:00
1 parent dfea86a8bc
commit 922c8d8ed2
3 files changed
+12 -2

No files matched your search

+1 -1
View File
@@ -138,7 +138,7 @@ public sealed class AuthController(
}
[AllowAnonymous]
[EnableRateLimiting("public-auth")]
[EnableRateLimiting("captcha-challenge")]
[HttpPost("login/captcha")]
public async Task<ActionResult<LoginCaptchaResponse>> CreateLoginCaptcha(CancellationToken cancellationToken)
{
+10
View File
@@ -598,6 +598,16 @@ builder.Services.AddRateLimiter(options =>
QueueLimit = 0,
AutoReplenishment = true
}));
options.AddPolicy("captcha-challenge", context =>
RateLimitPartition.GetFixedWindowLimiter(
context.Connection.RemoteIpAddress?.ToString() ?? "unknown",
_ => new FixedWindowRateLimiterOptions
{
PermitLimit = 30,
Window = TimeSpan.FromMinutes(5),
QueueLimit = 0,
AutoReplenishment = true
}));
options.AddPolicy("token-refresh", context =>
RateLimitPartition.GetFixedWindowLimiter(
context.Connection.RemoteIpAddress?.ToString() ?? "unknown",