mirror of
				https://github.com/nsnail/IGeekFan.AspNetCore.Knife4jUI.git
				synced 2025-11-04 13:50:50 +08:00 
			
		
		
		
	add 验证码demo示例
This commit is contained in:
		@@ -0,0 +1,26 @@
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using Microsoft.AspNetCore.Http;
 | 
			
		||||
using Microsoft.AspNetCore.Mvc;
 | 
			
		||||
using NCaptcha.Abstractions;
 | 
			
		||||
using NCaptcha.AspNetCore.Extensions;
 | 
			
		||||
 | 
			
		||||
namespace OAuth2Integration.ResourceServer.Controllers
 | 
			
		||||
{
 | 
			
		||||
    [Route("captcha")]
 | 
			
		||||
    public class CaptchaController : Controller
 | 
			
		||||
    {
 | 
			
		||||
        private readonly ICaptchaGenerator _captchaGenerator;
 | 
			
		||||
 | 
			
		||||
        public CaptchaController(ICaptchaGenerator captchaGenerator)
 | 
			
		||||
        {
 | 
			
		||||
            _captchaGenerator = captchaGenerator;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        [Produces("image/gif", Type = typeof(FileContentResult))]
 | 
			
		||||
        [HttpGet]
 | 
			
		||||
        public async Task<IActionResult> OnGetCaptchaAsync() => await _captchaGenerator.GetCaptchaFileResultAsync();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user