BlazorBasics.Captcha
1.0.2
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package BlazorBasics.Captcha --version 1.0.2
NuGet\Install-Package BlazorBasics.Captcha -Version 1.0.2
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="BlazorBasics.Captcha" Version="1.0.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add BlazorBasics.Captcha --version 1.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: BlazorBasics.Captcha, 1.0.2"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install BlazorBasics.Captcha as a Cake Addin #addin nuget:?package=BlazorBasics.Captcha&version=1.0.2 // Install BlazorBasics.Captcha as a Cake Tool #tool nuget:?package=BlazorBasics.Captcha&version=1.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
BlazorBasics.Captcha
Add a captcha control into your Balzor Server or Blazor Webassembly application
How to use
Nugget installation
PM> Install-Package BlazorBasics.Captcha
Or clone the repository and add the project to your solution.<br/>
Use the component CaptchaComponent into the component you want to check a real user.
<CaptchaComponent />
Parameters
CaptchaProperties Properties; //how to configure the captcha
EventCallback<bool> OnValidate; //delegate to execute when validate the captcha
Func<Task<IEnumerable<CaptchaItem>>> DataSource; //delegate from where get the CaptchaItems to validate
RenderFragment BeforeValidate; //content to show before validate
RenderFragment AfterValidate; //content to show after validate
EventCallback OnSubmit; //delegate to use when default button is set different of submit
Dictionary<string, object> WrapperAttributes; //attributes for the container of the HTML
Entities
namespace BlazorBasics.Captcha.Entities;
public enum ButtonType
{
Submit, Button, Reset
}
public class CaptchaItem
{
public string Question { get; set; }
public string Response { get; set; }
public bool Selected { get; set; }
public CaptchaItem() { }
public CaptchaItem(string question, string response) : this(question, response, false) { }
public CaptchaItem(string question, string response, bool selected)
{
Question = question;
Response = response;
Selected = selected;
}
}
public record struct CaptchaProperties(
CaptchaType Type = CaptchaType.Numeric,
string Description = "",
string Placeholder = "",
ButtonType Button = ButtonType.Submit,
string ErrorMessage = "Not Match!");
public enum CaptchaType
{
Numeric, CountryCapitals, Custom
}
Personalize content
<EditForm Model="ContactUsForm" OnValidSubmit="SendForm">
<div class="columns">
<div class="column">
<div class="field">
<label class="label"></label>
<div class="control">
<InputText class="input" type="email" placeholder="Email Address" @bind-Value=Email />
</div>
</div>
</div>
</div>
<div class="columns">
<CaptchaComponent class="column" Properties=MyCaptcha>
<BeforeValidate>
<span class="button is-link">Solve math</span>
</BeforeValidate>
<AfterValidate>
<div class="column">
<button type="submit" class="button is-info">SEND MESSAGE</button>
</div>
</AfterValidate>
</CaptchaComponent>
</div>
</EditForm>
@code{
string Email;
CaptchaProperties MyCaptcha = new CaptchaProperties(
Type: CaptchaType.Numeric,
ErrorMessage: "Solve the math correctly please...");
void SendForm(){
//some code...
}
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net6.0
- Microsoft.AspNetCore.Components.Web (>= 6.0.26)
-
net7.0
- Microsoft.AspNetCore.Components.Web (>= 7.0.15)
-
net8.0
- Microsoft.AspNetCore.Components.Web (>= 8.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Fixed issue when StateHasChanged() it's fired. Update to use with Net6, Net7, Net8