Persilsoft.Recaptcha.Blazor
1.0.5
See the version list below for details.
dotnet add package Persilsoft.Recaptcha.Blazor --version 1.0.5
NuGet\Install-Package Persilsoft.Recaptcha.Blazor -Version 1.0.5
<PackageReference Include="Persilsoft.Recaptcha.Blazor" Version="1.0.5" />
paket add Persilsoft.Recaptcha.Blazor --version 1.0.5
#r "nuget: Persilsoft.Recaptcha.Blazor, 1.0.5"
// Install Persilsoft.Recaptcha.Blazor as a Cake Addin #addin nuget:?package=Persilsoft.Recaptcha.Blazor&version=1.0.5 // Install Persilsoft.Recaptcha.Blazor as a Cake Tool #tool nuget:?package=Persilsoft.Recaptcha.Blazor&version=1.0.5
Persilsoft.Recaptcha.Blazor
It exposes a service that allows you to obtain a reCAPTCHA token and validate that token through a verification endpoint that you need to add to your backend.
Example
First, you need to register the following service group in the dependency container.
using Persilsoft.Recaptcha.Blazor.Options;
using ServiceCollectionExtensions;
builder.Services.Configure<RecaptchaOptions>(builder.Configuration.GetSection(RecaptchaOptions.SectionKey));
builder.Services.AddRecaptchaServices();
In the appsetting.json configuration file, you need to configure the following key:
"Recaptcha": {
"WebApiBaseAddress": "https://persilsoft.api",
"VerifyRecaptcha": "/recaptcha/verify",
"SiteKey": "xxxxxxxxxxx"
}
Where:
WebApiBaseAddress: It is the Base URL of your backend server that will expose the token verification endpoint.
VerifyRecaptcha: It is the token verification endpoint on your backend server.
SiteKey: It is your website key, also known as the reCAPTCHA key.
Now, you can use the service in your Razor page.
@page "/recaptcha"
@using Persilsoft.Recaptcha.Shared.Interfaces
@inject IRecaptchaValidatorService RecaptchaValidatorService
<h3>Demo</h3>
<EditForm Model="@model" OnValidSubmit="Send">
<DataAnnotationsValidator />
<div class="mb-3">
<label for="name" class="form-label">Nombre</label>
<input type="text" @bind="model.Name" class="form-control" id="name" name="name" />
<ValidationMessage For="@(() => model.Name)" />
</div>
<div class="d-grid gap-2 col-6 mx-auto">
<button class="btn btn-danger" type="submit">Enviar</button>
</div>
<hr />
<div class="mt-3">
<textarea disabled class="form-control">
@result
</textarea>
</div>
</EditForm>
@code {
private readonly PersonModel model = new();
private string result;
private async Task Send()
{
try
{
await RecaptchaValidatorService.TryVerifyInteraction();
result = "Successful validation!!!";
}
catch (Exception ex)
{
result = ex.Message;
}
}
public class PersonModel
{
[Required(ErrorMessage = "{0} is required.")]
public string Name { get; set; }
}
}
Note: The invocation of the TryVerifyInteraction method will throw an exception if the reCAPTCHA validation process fails.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | 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. |
-
net8.0
- Microsoft.AspNetCore.Components.Web (>= 8.0.4)
- Microsoft.Extensions.Http (>= 8.0.0)
- Persilsoft.Blazor.JSInterop (>= 1.0.1)
- Persilsoft.HttpDelegatingHandlers (>= 1.0.2)
- Persilsoft.Recaptcha.Shared (>= 1.0.2)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Persilsoft.Recaptcha.Blazor:
Package | Downloads |
---|---|
Persilsoft.Membership.Blazor
Contains razor clases for use in frontend membership projects |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.31 | 215 | 10/16/2024 |
1.0.30 | 106 | 10/16/2024 |
1.0.29 | 64 | 10/15/2024 |
1.0.28 | 109 | 10/14/2024 |
1.0.27 | 108 | 10/6/2024 |
1.0.26 | 101 | 10/4/2024 |
1.0.25 | 107 | 10/4/2024 |
1.0.24 | 115 | 9/1/2024 |
1.0.23 | 134 | 8/28/2024 |
1.0.22 | 89 | 8/28/2024 |
1.0.21 | 117 | 8/18/2024 |
1.0.20 | 108 | 8/18/2024 |
1.0.19 | 115 | 8/17/2024 |
1.0.18 | 106 | 8/17/2024 |
1.0.17 | 118 | 8/17/2024 |
1.0.16 | 78 | 7/29/2024 |
1.0.15 | 247 | 7/20/2024 |
1.0.14 | 276 | 5/26/2024 |
1.0.13 | 95 | 5/26/2024 |
1.0.12 | 216 | 5/25/2024 |
1.0.11 | 114 | 5/25/2024 |
1.0.10 | 119 | 5/25/2024 |
1.0.9 | 146 | 5/23/2024 |
1.0.8 | 261 | 5/18/2024 |
1.0.7 | 122 | 5/18/2024 |
1.0.6 | 156 | 5/17/2024 |
1.0.5 | 138 | 5/5/2024 |
1.0.4 | 123 | 5/4/2024 |
1.0.3 | 76 | 5/3/2024 |
1.0.2 | 86 | 5/1/2024 |
1.0.1 | 106 | 4/24/2024 |
1.0.0 | 111 | 4/22/2024 |