From 5ea1184813c25db54c6d8366128cde2d309a060b Mon Sep 17 00:00:00 2001 From: linmeideli <2558527373@qq.com> Date: Sun, 15 Nov 2026 11:50:25 +0800 Subject: [PATCH] Port --- src/Empostor.Server/Http/VerifyController.cs | 49 -------------------- 1 file changed, 49 deletions(-) delete mode 100644 src/Empostor.Server/Http/VerifyController.cs diff --git a/src/Empostor.Server/Http/VerifyController.cs b/src/Empostor.Server/Http/VerifyController.cs deleted file mode 100644 index 794a4ed..0000000 --- a/src/Empostor.Server/Http/VerifyController.cs +++ /dev/null @@ -1,49 +0,0 @@ -using System.Text.Json.Serialization; -using Empostor.Api.Service.Admin.Verify; -using Microsoft.AspNetCore.Mvc; - -namespace Empostor.Server.Http; - -[Route("/api/verify")] -[ApiController] -public sealed class VerifyController : ControllerBase -{ - private readonly IVerifyStore _store; - - public VerifyController(IVerifyStore store) - { - _store = store; - } - - [HttpPost("confirm")] - public IActionResult Confirm([FromBody] VerifyConfirmRequest req) - { - if (!_store.ValidateSecret(req.Secret)) - { - return Unauthorized(new { ok = false, error = "Invalid bot secret." }); - } - - if (string.IsNullOrWhiteSpace(req.FriendCode) || string.IsNullOrWhiteSpace(req.UserOpenid)) - { - return BadRequest(new { ok = false, error = "friendCode and userOpenid are required." }); - } - - var ok = _store.TryConfirm(req.FriendCode, req.UserOpenid); - if (ok) - { - return Ok(new { ok = true }); - } - - return Ok(new - { - ok = false, - error = "no_pending_or_expired", - message = "No record found or the record has expired.", - }); - } - - public sealed record VerifyConfirmRequest( - [property: JsonPropertyName("friendCode")] string FriendCode, - [property: JsonPropertyName("userOpenid")] string UserOpenid, - [property: JsonPropertyName("secret")] string Secret); -}