Skip to content

Commit 23b2eba

Browse files
Fail closed on missing captcha config
1 parent dab18ce commit 23b2eba

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

EssentialCSharp.Web.Tests/CaptchaValidationServiceTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace EssentialCSharp.Web.Tests;
88
public class CaptchaValidationServiceTests
99
{
1010
[Test]
11-
public async Task ValidateAsync_Disabled_SkipsVerification()
11+
public async Task ValidateAsync_MissingConfig_RejectsWithoutVerification()
1212
{
1313
StubCaptchaService captchaService = new((_, _, _) => throw new InvalidOperationException("Verifier should not be called."));
1414
using ServiceProvider serviceProvider = CreateServiceProvider(
@@ -20,7 +20,7 @@ public async Task ValidateAsync_Disabled_SkipsVerification()
2020
CaptchaValidationResult result = await validationService.ValidateAsync("token", "127.0.0.1");
2121

2222
await Assert.That(result.Outcome).IsEqualTo(CaptchaValidationOutcome.Disabled);
23-
await Assert.That(result.ShouldProceed).IsTrue();
23+
await Assert.That(result.ShouldProceed).IsFalse();
2424
await Assert.That(captchaService.CallCount).IsEqualTo(0);
2525
}
2626

EssentialCSharp.Web/Services/CaptchaValidationResult.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ namespace EssentialCSharp.Web.Services;
44

55
public sealed record CaptchaValidationResult(CaptchaValidationOutcome Outcome, HCaptchaResult? Response)
66
{
7-
public bool ShouldProceed => Outcome is CaptchaValidationOutcome.Disabled or CaptchaValidationOutcome.Valid;
7+
public bool ShouldProceed => Outcome is CaptchaValidationOutcome.Valid;
88
}

0 commit comments

Comments
 (0)