forked from VahidN/DNTCaptcha.Core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNgxController.cs
27 lines (26 loc) · 896 Bytes
/
NgxController.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
using DNTCaptcha.Core;
using DNTCaptcha.Core.Providers;
using DNTCaptcha.TestWebApp.Models;
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Mvc;
namespace DNTCaptcha.TestWebApp.Controllers
{
[Route("api/[controller]")]
[EnableCors("CorsPolicy")]
public class NgxController : Controller
{
[HttpPost("[action]")]
[ValidateDNTCaptcha(ErrorMessage = "Please enter the security code as a number.",
IsNumericErrorMessage = "The input value should be a number.",
CaptchaGeneratorLanguage = Language.English)]
public IActionResult Login([FromBody]AccountViewModel data)
{
if (ModelState.IsValid)
{
//TODO: Save data
return Ok(new { name = data.Username });
}
return BadRequest(ModelState);
}
}
}