Blazor-Captcha
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 CaptchaWord="@Captcha" OnRefresh="NewCaptchaEvent" />
<p>@Captcha</p>
@code{
private string Captcha = "";
private void NewCaptchaEvent()
{
Captcha = BlazorCaptcha.Tools.GetCaptchaWord(5);
}
protected override Task OnInitializedAsync()
{
NewCaptchaEvent();
return base.OnInitializedAsync();
}
}