Captcha-Blazor-Captcha

[删除(380066935@qq.com或微信通知)]

Blazor-Captcha

tossnet/Blazor-Captcha: Generates a captcha image for a Blazor Server application (github.com)

Generates a captcha image for a Blazor Server application.

Installation

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();
    }
}