Skip to content

Generates a captcha image for a Blazor application

License

GPL-3.0, GPL-3.0 licenses found

Licenses found

GPL-3.0
LICENSE
GPL-3.0
LICENSE.txt
Notifications You must be signed in to change notification settings

tossnet/Blazor-Captcha

Repository files navigation

Blazor-Captcha

NuGet BlazorCaptcha Nuget Package

Generates a captcha image for a Blazor Server or Webassembly application.

Blazor Captcha

Installation

Latest version in here: NuGet

To Install

Install-Package BlazorCaptcha

or

dotnet add package BlazorCaptcha

For client-side and server-side Blazor - add script section to _Host.cshtml (head section)

<link href="_content/BlazorCaptcha/captcha.css" rel="stylesheet" />

Usage

@page "/"
@using BlazorCaptcha

<h3>Hello, world!</h3>


<Captcha @bind-CaptchaWord="@Captcha" CharNumber="@CaptchaLetters" />

<p>@Captcha</p>

@code{
    private string Captcha = "";
    private int CaptchaLetters = 5;

    protected override Task OnInitializedAsync()
    {
        Captcha = BlazorCaptcha.Tools.GetCaptchaWord(CaptchaLetters);

        return base.OnInitializedAsync();
    }
}

Release Notes

Version 1.6.0
  • issue #12
Version 1.5.0
  • Add DotNet 8.0 framework target
Version 1.4.2
  • Update nuget packages
Version 1.4.1
  • To avoid any confusion, remove 'x', 'V', 'v' chars
Version 1.4.0
  • issue #10 Characters did not always fit inside the div
  • remove 'X' and '+' chars
Version 1.3.0
  • migrate to .NET 7
Version 1.2.4
  • minor improvement
Version 1.2.3
  • Add type="button"
Version 1.2.2
  • add nuget package SkiaSharp.NativeAssets.Linux
Version 1.2.0
  • NET6, removal of the bootstrap class

⚠️ Breaking changes ⚠️

Version 1.0.1 to 1.1.0
  • Change the parameter "CaptchaWord" => "@bind-CaptchaWord"
  • Add the parameter with the length of the word ex : "CharNumber="@CaptchaLetters"
  • Remove the "OnRefresh" parameter