Skip to content

git102347501/Abp.Captcha

Repository files navigation

Abp.Captcha

This is an open source module based on ABP module, which provides human-machine verification and behavior safety verification. You can use this module to verify the human-machine of your application interface caller, and control the behavior risk of the user to match the appropriate verification rules, so as to ensure that the program call can be operated by yourself more safely.

NuGet License

DEMO

  • User Interface:

  • User Interface

  • API Manage:

  • API Manage

The first stage will provide man-machine verification module, slide bar verification and puzzle verification and user behavior safety assessment module based on ABP vNext.

Quick Start

Install the ABP CLI:

> dotnet add package MagicalConch.Abp.Captcha.Web
> dotnet add package MagicalConch.Abp.Captcha.Application.Contracts
> dotnet add package MagicalConch.Abp.Captcha.Domain
> dotnet add package MagicalConch.Abp.Captcha.Application 
> dotnet add package MagicalConch.Abp.Captcha.HttpApi.Client 
> dotnet add package MagicalConch.Abp.Captcha.EntityFrameworkCore 
> dotnet add package MagicalConch.Abp.Captcha.Domain.Shared 
> dotnet add package MagicalConch.Abp.Captcha.HttpApi 
> dotnet add package MagicalConch.Abp.Captcha.Web

Using module and configure:

  using MaigcalConch.Abp.Captcha;
  
  // Form:XXXApplicationModule:
    // ...
      typeof(MagicalConchCaptchaApplicationModule)
    // ...
    
  // Form:XXXApplicationContractsModule:
    // ...
      typeof(MagicalConchCaptchaApplicationContractsModule)
    // ...
    
  // Form:XXXDomainModule:
    // ...
      typeof(MagicalConchCaptchaDomainModule)
    // ...
    
  // Form:XXXDomainSharedModule:
    // ...
      typeof(MagicalConchCaptchaDomainSharedModule)
    // ...
    
  // Form:XXXEntityFrameworkCoreModule:
    // ...
      typeof(BlogEntityFrameworkCoreModule)
    // ...
    
  // Form:XXXHttpApiModule:
    // ...
      typeof(MagicalConchCaptchaHttpApiModule)
    // ...
    
  // Form:XXXHttpApiHostModule:
    // ...
      typeof(MagicalConchCaptchaWebModule)
    // ...
    private void ConfigureConventionalControllers()
      {
        // ...
        options
           .ConventionalControllers
           .Create(typeof(MagicalConchCaptchaApplicationModule).Assembly);
        // ...
      }
    ...

Using Authentication in API Controllers

 /// <summary>
    /// test
    /// </summary>
    [RemoteService]
    [Route("api/Captcha/sample")]
    public class SampleController : CaptchaController
    {
        [HttpGet]
        [Route("test")]
        [Captcha]
        public bool GetTest()
        {
            return true;
        }

        [HttpGet]
        [Route("slidertest")]
        [Slider]
        public bool GetTest1()
        {
            return true;
        }
    }

Angular Using:

Add Npm Package:

yarn add abpcaptcha
or
npm i abpcaptcha

Import Module:

@NgModule({
  ...
  imports: [
    ...
    CaptchaModule
  ]
  ...
})

export class YourModule { }

For Dom:

<app-captcha-picture ref="captcha" url="{your captcha api basic url}"></app-captcha-picture>
Get the properties {index, code} in the component through ref

For Modal:

const modal = this.modal.create({
  nzTitle: 'Captcha',
  nzContent: CaptchaPictureComponent,
  nzViewContainerRef: this.viewContainerRef,
  nzComponentParams: {
    url: {your captcha api basic url}
  }
});

modal.afterClose.subscribe(result => {
  const instance = modal.getContentComponent();
  this.httpservice.yourapi(this.yourform.value, instance.index, instance.code).subscribe((res: any) => {
    alert('sucess');
  }, err => {
    alert('err');
  });
});

Using frames

  • Abp vNext:5.3.0
  • Obj Type:Module

Environment dependent

  • Redis

Module Configuration Description

TODO

UML

  • User Action

    1677551288000

Operation Instructions

TODO

Online Demo

MagicalConch