验证码优化

This commit is contained in:
biss committed 2026-09-12 07:57:27 +08:00
1 parent f489a3553c
commit 4a3bb84aa4
17 files changed
+156 -430

No files matched your search

@@ -10,6 +10,8 @@ using Microsoft.Data.Sqlite;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Storage;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Configuration;
using Lazy.Captcha.Core;
namespace Jiaowu.Api.Tests;
@@ -47,6 +49,8 @@ public sealed class AuthControllerTests
await connection.OpenAsync();
var services = new ServiceCollection();
services.AddLogging();
services.AddDistributedMemoryCache();
services.AddCaptcha(new ConfigurationBuilder().Build());
services.AddDbContext<AppDbContext>(options => options
.UseSqlite(connection)
.ReplaceService<IExecutionStrategyFactory, RetryingExecutionStrategyFactory>());
@@ -109,8 +113,7 @@ public sealed class AuthControllerTests
userManager,
new StubAuthSessionService(),
new TwoFactorLoginTicketService(new Microsoft.AspNetCore.DataProtection.EphemeralDataProtectionProvider()),
new LoginCaptchaService(new Microsoft.Extensions.Caching.Distributed.MemoryDistributedCache(
Microsoft.Extensions.Options.Options.Create(new Microsoft.Extensions.Caching.Memory.MemoryDistributedCacheOptions()))),
scope.ServiceProvider.GetRequiredService<ICaptcha>(),
NoOpAppCache.Instance);
var request = new StudentActivationRequest(
student.Name,