自建登录验证码
This commit is contained in:
1 parent
149eb66890
commit
564ffecfed
9 files changed
+75
-49
No files matched your search
@@ -12,7 +12,7 @@ using Microsoft.AspNetCore.RateLimiting;
|
||||
using Microsoft.AspNetCore.WebUtilities;
|
||||
using Microsoft.Extensions.Caching.Distributed;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Lazy.Captcha.Core;
|
||||
using CaptchaKit.AspNetCore;
|
||||
using Microsoft.IdentityModel.Protocols.OpenIdConnect;
|
||||
|
||||
namespace Jiaowu.Api.Controllers;
|
||||
@@ -23,7 +23,7 @@ public sealed class SsoController(
|
||||
UserManager<ApplicationUser> userManager,
|
||||
IAuthSessionService authSessionService,
|
||||
IDistributedCache cache,
|
||||
ICaptcha captcha,
|
||||
ICaptchaKitService captcha,
|
||||
IOptions<SsoOptions> options,
|
||||
ILogger<SsoController> logger) : ControllerBase
|
||||
{
|
||||
@@ -59,7 +59,7 @@ public sealed class SsoController(
|
||||
if (string.IsNullOrWhiteSpace(bindingIntent) &&
|
||||
(string.IsNullOrWhiteSpace(captchaId) ||
|
||||
string.IsNullOrWhiteSpace(captchaCode) ||
|
||||
!captcha.Validate(captchaId, captchaCode)))
|
||||
!await captcha.VerifyAsync(captchaId, captchaCode, cancellationToken)))
|
||||
{
|
||||
return Unauthorized(AuthController.LoginCaptchaProblem());
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user