src/SSCMS.Web/Controllers/V1/CaptchaController.Check.cs
(完整代码) 1KBusing System;
using Microsoft.AspNetCore.Mvc;
using NSwag.Annotations;
using SSCMS.Core.Utils;
using SSCMS.Dto;
using SSCMS.Utils;
namespace SSCMS.Web.Controllers.V1
{
public partial class CaptchaController
{
[OpenApiOperation("验证验证码 API", "验证验证码,使用POST发起请求,请求地址为/api/v1/captcha/actions/check,此接口可以直接访问,无需身份验证。")]
[HttpPost, Route(RouteActionsCheck)]
public ActionResult<BoolResult> Check([FromBody] CheckRequest request)
{
var captcha = TranslateUtils.JsonDeserialize<CaptchaUtils.Captcha>(_settingsManager.Decrypt(request.Value));
if (captcha == null || string.IsNullOrEmpty(captcha.Value) || captcha.ExpireAt < DateTime.Now)
{
return this.Error("验证码已超时,请点击刷新验证码!");
}
if (!StringUtils.EqualsIgnoreCase(captcha.Value, request.Captcha))
{
return this.Error("验证码不正确,请重新输入!");
}
return new BoolResult
{
Value = true
};
}
}
}
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
