diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/.template.config/template.json b/src/Templates/Boilerplate/Bit.Boilerplate/.template.config/template.json index 01c9c79a7f..03c24c481a 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/.template.config/template.json +++ b/src/Templates/Boilerplate/Bit.Boilerplate/.template.config/template.json @@ -51,6 +51,12 @@ "format": "yyyy-MM-dd" } }, + "api": { + "displayName": "Add API to Server project?", + "type": "parameter", + "datatype": "bool", + "defaultValue": "true" + }, "database": { "displayName": "Backend database", "type": "parameter", @@ -123,12 +129,6 @@ "datatype": "bool", "defaultValue": "false" }, - "api": { - "displayName": "Add API to Server project?", - "type": "parameter", - "datatype": "bool", - "defaultValue": "true" - }, "appInsights": { "displayName": "Add Azure application insights to project?", "type": "parameter", @@ -277,6 +277,9 @@ "src/Boilerplate.Server/Services/AppSecureJwtDataFormat.cs", "src/Boilerplate.Server/wwwroot/swagger/**", "src/Boilerplate.Server/AppSettings.cs", + "src/Boilerplate.Server/Services/GoogleRecaptchaHttpClient.cs", + "src/Boilerplate.Server/Services/GoogleRecaptchaVerificationResponse.cs", + "src/Boilerplate.Server/Services/ServerJsonContext.cs", "src/Boilerplate.Server/IdentityCertificate.pfx" ] }, diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Boilerplate.Server/Program.Services.cs b/src/Templates/Boilerplate/Bit.Boilerplate/src/Boilerplate.Server/Program.Services.cs index 27132672fd..ea31c5cd2f 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Boilerplate.Server/Program.Services.cs +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Boilerplate.Server/Program.Services.cs @@ -144,10 +144,12 @@ private static void ConfigureServices(this WebApplicationBuilder builder) AddBlazor(builder); + //#if (api == true) services.AddHttpClient(c => { c.BaseAddress = new Uri("https://www.google.com/recaptcha/"); }); + //#endif } private static void AddBlazor(WebApplicationBuilder builder) diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Boilerplate.Server/Services/GoogleRecaptchaHttpClient.cs b/src/Templates/Boilerplate/Bit.Boilerplate/src/Boilerplate.Server/Services/GoogleRecaptchaHttpClient.cs index 6964e542e5..4e14c3813f 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Boilerplate.Server/Services/GoogleRecaptchaHttpClient.cs +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Boilerplate.Server/Services/GoogleRecaptchaHttpClient.cs @@ -17,6 +17,6 @@ public async ValueTask Verify(string? googleRecaptchaResponse) var result = await response.Content.ReadFromJsonAsync(ServerJsonContext.Default.GoogleRecaptchaVerificationResponse); - return result?.Success ?? false; + return result?.Success is true; } } diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Boilerplate.Shared/Resources/AppStrings.Designer.cs b/src/Templates/Boilerplate/Bit.Boilerplate/src/Boilerplate.Shared/Resources/AppStrings.Designer.cs index 139c8c2516..0683084447 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Boilerplate.Shared/Resources/AppStrings.Designer.cs +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Boilerplate.Shared/Resources/AppStrings.Designer.cs @@ -1078,15 +1078,6 @@ public static string ResetPasswordTitle { } } - /// - /// Looks up a localized string similar to Reset reCAPTCHA. - /// - public static string ResetRecaptcha { - get { - return ResourceManager.GetString("ResetRecaptcha", resourceCulture); - } - } - /// /// Looks up a localized string similar to Resource not found. /// diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Boilerplate.Shared/Resources/AppStrings.fa.resx b/src/Templates/Boilerplate/Bit.Boilerplate/src/Boilerplate.Shared/Resources/AppStrings.fa.resx index 80d414d956..494a012057 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Boilerplate.Shared/Resources/AppStrings.fa.resx +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Boilerplate.Shared/Resources/AppStrings.fa.resx @@ -583,7 +583,4 @@ شما باید چالش گوگل ریکپچا را به سرانجام برسانید. - - بازنشانی ریکپجا - \ No newline at end of file diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Boilerplate.Shared/Resources/AppStrings.fr.resx b/src/Templates/Boilerplate/Bit.Boilerplate/src/Boilerplate.Shared/Resources/AppStrings.fr.resx index 9b366a04c4..15a0e6d4b6 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Boilerplate.Shared/Resources/AppStrings.fr.resx +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Boilerplate.Shared/Resources/AppStrings.fr.resx @@ -582,7 +582,4 @@ Vous devez réussir le défi Google reCAPTCHA. - - Réinitialiser reCAPTCHA - \ No newline at end of file diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Boilerplate.Shared/Resources/AppStrings.resx b/src/Templates/Boilerplate/Bit.Boilerplate/src/Boilerplate.Shared/Resources/AppStrings.resx index bd6f718435..651a6cd081 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Boilerplate.Shared/Resources/AppStrings.resx +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Boilerplate.Shared/Resources/AppStrings.resx @@ -590,9 +590,6 @@ Please confirm your email by clicking on the link. You need to pass the Google reCAPTCHA challenge. - - - Reset reCAPTCHA \ No newline at end of file diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Identity/ForgotPasswordPage.razor.cs b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Identity/ForgotPasswordPage.razor.cs index 249a6a8118..19e975e72e 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Identity/ForgotPasswordPage.razor.cs +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Identity/ForgotPasswordPage.razor.cs @@ -43,11 +43,14 @@ private async Task DoSubmit() forgotPasswordMessage = e.Message; } + catch + { + await JSRuntime.GoogleRecaptchaReset(); + throw; + } finally { isLoading = false; - - await JSRuntime.GoogleRecaptchaReset(); } } } diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Identity/GoogleRecaptcha.razor b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Identity/GoogleRecaptcha.razor index 421d0c6488..14d58aa6d3 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Identity/GoogleRecaptcha.razor +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Identity/GoogleRecaptcha.razor @@ -5,9 +5,4 @@ -
- - \ No newline at end of file +
\ No newline at end of file diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Identity/SignInPage.razor.cs b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Identity/SignInPage.razor.cs index 459898490d..6861527666 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Identity/SignInPage.razor.cs +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Identity/SignInPage.razor.cs @@ -51,11 +51,14 @@ private async Task DoSignIn() signInMessage = e.Message; } + catch + { + await JSRuntime.GoogleRecaptchaReset(); + throw; + } finally { isLoading = false; - - await JSRuntime.GoogleRecaptchaReset(); } } } diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Identity/SignUpPage.razor.cs b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Identity/SignUpPage.razor.cs index e6eba6abf5..608d0af9b7 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Identity/SignUpPage.razor.cs +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Identity/SignUpPage.razor.cs @@ -71,11 +71,14 @@ private async Task DoResendLink() signUpMessage = e.Message; signUpMessageType = BitMessageBarType.Error; } + catch + { + await JSRuntime.GoogleRecaptchaReset(); + throw; + } finally { isLoading = false; - - await JSRuntime.GoogleRecaptchaReset(); } } }