/SimCaptcha

✅ 一个简单易用的点触验证码 (前端+后端)

Primary LanguageC#MIT LicenseMIT

SimCaptcha

SimCaptcha

🍰 一个简单易用的点触验证码, 包含了前端与后端实现

repo size LICENSE nuget downloads

介绍

一个简单易用的点触验证码促进你的开发

  • 简单 - 约定优于配置, 以最少的配置帮助你专注于业务.
  • 易扩展 - 松散架构, 轻松扩展.
  • 开箱即用 - 使用现有 Web SDK 接入后端验证

在线演示

前后端调用时序图

依赖

只需要满足下方其中一条.

  • .NET Framework (>= 4.0) 被安装.
  • .NET Standard (>= 2.0) 被安装.

安装

推荐使用 NuGet, 在你项目的根目录 执行下方的命令, 如果你使用 Visual Studio, 这时依次点击 Tools -> NuGet Package Manager -> Package Manager Console , 确保 "Default project" 是你想要安装的项目, 输入下方的命令进行安装.

PM> Install-Package SimCaptcha

在 ASP.NET Core 下使用

PM> Install-Package SimCaptcha.AspNetCore

快速开始

在 ASP.NET Core 下 三步搭建验证服务端

// Startup.cs 
// 注意: 省略了部分代码, 只保留主要部分, 详见示例(/examples/EasyAspNetCoreService)
// 仅适用于 SimCaptcha.AspNetCore v0.2.0+
public void ConfigureServices(IServiceCollection services)
{
    // 1.重要: 注册验证码配置
    services.Configure<SimCaptchaOptions>(Configuration.GetSection(SimCaptchaOptions.SimCaptcha));

    // 2.添加 SimCaptcha
    services.AddSimCaptcha();
}

public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
    // 3.启用 SimCaptcha 中间件
    app.UseSimCaptcha();

    // 现在
    // "https://yourdomain.com/api/vCode/VCodeImg", "https://yourdomain.com/api/vCode/VCodeCheck", "https://yourdomain.com/api/vCode/TicketVerify"
    // 将开始工作
}

使用

环境

  • 运行环境: .NET Framework (>= 4.0) or .NET Standard (>= 2.0)
  • 开发环境: Visual Studio Community 2019

相关项目

鸣谢

Donate

SimCaptcha is an MIT licensed open source project and completely free to use. However, the amount of effort needed to maintain and develop new features for the project is not sustainable without proper financial backing.

We accept donations through these channels:

Author

SimCaptcha © yiyun, Released under the MIT License.
Authored and maintained by yiyun with help from contributors (list).

GitHub @yiyungent