add 验证码demo示例

This commit is contained in:
luoyunchong
2020-09-04 01:37:34 +08:00
parent 35fa68cffc
commit 8a4066a40e
6 changed files with 80 additions and 14 deletions

View File

@ -4,6 +4,8 @@ using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Authentication.Cookies;
using IdentityServer4;
using IdentityServer4.Test;
using NCaptcha.Abstractions;
using NCaptcha.AspNetCore.Extensions;
namespace OAuth2Integration.AuthServer.Controllers
{
@ -26,8 +28,9 @@ namespace OAuth2Integration.AuthServer.Controllers
return View("/AuthServer/Views/Login.cshtml", viewModel);
}
[HttpPost("login")]
public async Task<IActionResult> Login([FromForm]LoginViewModel viewModel)
public async Task<IActionResult> Login([FromForm] LoginViewModel viewModel)
{
if (!_userStore.ValidateCredentials(viewModel.Username, viewModel.Password))
{
@ -43,6 +46,7 @@ namespace OAuth2Integration.AuthServer.Controllers
return Redirect(viewModel.ReturnUrl);
}
}
public class LoginViewModel