Skip to content

Commit bf59987

Browse files
authored
Merge pull request #2 from maliming/dev
0.3.0
2 parents 5cf68ae + a2657b3 commit bf59987

31 files changed

+53
-61
lines changed

demo/reCAPTCHA.Demo/Pages/Error.cshtml.cs

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
1-
using System;
2-
using System.Collections.Generic;
31
using System.Diagnostics;
4-
using System.Linq;
5-
using System.Threading.Tasks;
62
using Microsoft.AspNetCore.Mvc;
73
using Microsoft.AspNetCore.Mvc.RazorPages;
84
using Microsoft.Extensions.Logging;
95

10-
namespace reCAPTCHA.Tests.Pages
6+
namespace reCAPTCHA.Demo.Pages
117
{
128
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
139
public class ErrorModel : PageModel

demo/reCAPTCHA.Demo/Pages/Index.cshtml.cs

+2-7
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Threading.Tasks;
5-
using Microsoft.AspNetCore.Mvc;
6-
using Microsoft.AspNetCore.Mvc.RazorPages;
1+
using Microsoft.AspNetCore.Mvc.RazorPages;
72
using Microsoft.Extensions.Logging;
83

9-
namespace reCAPTCHA.Tests.Pages
4+
namespace reCAPTCHA.Demo.Pages
105
{
116
public class IndexModel : PageModel
127
{

demo/reCAPTCHA.Demo/Pages/Privacy.cshtml.cs

+2-7
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Threading.Tasks;
5-
using Microsoft.AspNetCore.Mvc;
6-
using Microsoft.AspNetCore.Mvc.RazorPages;
1+
using Microsoft.AspNetCore.Mvc.RazorPages;
72
using Microsoft.Extensions.Logging;
83

9-
namespace reCAPTCHA.Tests.Pages
4+
namespace reCAPTCHA.Demo.Pages
105
{
116
public class PrivacyModel : PageModel
127
{

demo/reCAPTCHA.Demo/Pages/V2_Checkbox.cshtml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@page
2-
@model reCAPTCHA.Tests.Pages.V2_CheckboxModel
2+
@model reCAPTCHA.Demo.Pages.V2_CheckboxModel
33
@{
44
ViewData["Title"] = "V2_Checkbox";
55
}

demo/reCAPTCHA.Demo/Pages/V2_Checkbox.cshtml.cs

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
using System.Threading.Tasks;
22
using Microsoft.AspNetCore.Mvc.RazorPages;
33
using Newtonsoft.Json;
4-
using reCAPTCHA.v2;
4+
using Owl.reCAPTCHA;
5+
using Owl.reCAPTCHA.v2;
56

6-
namespace reCAPTCHA.Tests.Pages
7+
namespace reCAPTCHA.Demo.Pages
78
{
89
public class V2_CheckboxModel : PageModel
910
{

demo/reCAPTCHA.Demo/Pages/V2_Invisible.cshtml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
@page
2-
@model reCAPTCHA.Tests.Pages.V2_InvisibleModel
1+
@page
2+
@model reCAPTCHA.Demo.Pages.V2_InvisibleModel
33
@{
44
ViewData["Title"] = "V2_Invisible";
55
}

demo/reCAPTCHA.Demo/Pages/V2_Invisible.cshtml.cs

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
using System.Threading.Tasks;
22
using Microsoft.AspNetCore.Mvc.RazorPages;
33
using Newtonsoft.Json;
4-
using reCAPTCHA.v2;
4+
using Owl.reCAPTCHA;
5+
using Owl.reCAPTCHA.v2;
56

6-
namespace reCAPTCHA.Tests.Pages
7+
namespace reCAPTCHA.Demo.Pages
78
{
89
public class V2_InvisibleModel : PageModel
910
{

demo/reCAPTCHA.Demo/Pages/V3.cshtml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
@page
1+
@page
22
@using Microsoft.Extensions.Options
3-
@using reCAPTCHA.v3
4-
@model reCAPTCHA.Tests.Pages.V3Model
3+
@using Owl.reCAPTCHA
4+
@model reCAPTCHA.Demo.Pages.V3Model
55
@inject IOptions<reCAPTCHAOptions> Options
66
@{
77
ViewData["Title"] = "V3";

demo/reCAPTCHA.Demo/Pages/V3.cshtml.cs

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
using System.Threading.Tasks;
22
using Microsoft.AspNetCore.Mvc.RazorPages;
33
using Newtonsoft.Json;
4-
using reCAPTCHA.v3;
4+
using Owl.reCAPTCHA;
5+
using Owl.reCAPTCHA.v3;
56

6-
namespace reCAPTCHA.Tests.Pages
7+
namespace reCAPTCHA.Demo.Pages
78
{
89
public class V3Model : PageModel
910
{
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
@using reCAPTCHA.Tests
2-
@namespace reCAPTCHA.Tests.Pages
1+
@namespace reCAPTCHA.Demo.Pages
32
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
43
@addTagHelper *, Owl.reCAPTCHA

demo/reCAPTCHA.Demo/Program.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using Microsoft.AspNetCore.Hosting;
22
using Microsoft.Extensions.Hosting;
33

4-
namespace reCAPTCHA.Tests
4+
namespace reCAPTCHA.Demo
55
{
66
public class Program
77
{

demo/reCAPTCHA.Demo/Startup.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
using Microsoft.Extensions.Configuration;
44
using Microsoft.Extensions.DependencyInjection;
55
using Microsoft.Extensions.Hosting;
6+
using Owl.reCAPTCHA;
67

7-
namespace reCAPTCHA.Tests
8+
namespace reCAPTCHA.Demo
89
{
910
public class Startup
1011
{

src/Owl.reCAPTCHA/CultureInforeCAPTCHALanguageCodeProvider.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using System.Globalization;
22

3-
namespace reCAPTCHA
3+
namespace Owl.reCAPTCHA
44
{
55
public class CultureInforeCAPTCHALanguageCodeProvider : IreCAPTCHALanguageCodeProvider
66
{

src/Owl.reCAPTCHA/IreCAPTCHALanguageCodeProvider.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace reCAPTCHA
1+
namespace Owl.reCAPTCHA
22
{
33
public interface IreCAPTCHALanguageCodeProvider
44
{

src/Owl.reCAPTCHA/Owl.reCAPTCHA.csproj

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@
99
<PackageProjectUrl>https://github.com/maliming/reCAPTCHA</PackageProjectUrl>
1010
<RepositoryUrl>https://github.com/maliming/reCAPTCHA</RepositoryUrl>
1111
<RepositoryType>git</RepositoryType>
12-
<Version>0.2.0</Version>
12+
<Version>0.3.0</Version>
1313
<IsPackable>true</IsPackable>
1414
<OutputType>Library</OutputType>
1515
<PublishRepositoryUrl>true</PublishRepositoryUrl>
16+
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
1617
<!-- including PDB files in NuGet for source link because symbolsource.org does not support portable PDBs -->
1718
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
1819
</PropertyGroup>

src/Owl.reCAPTCHA/ServiceCollectionExtensions.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
using System;
22
using System.Net.Http;
33
using Microsoft.Extensions.DependencyInjection;
4-
using reCAPTCHA.v2;
5-
using reCAPTCHA.v3;
4+
using Owl.reCAPTCHA.v2;
5+
using Owl.reCAPTCHA.v3;
66

7-
namespace reCAPTCHA
7+
namespace Owl.reCAPTCHA
88
{
99
public static class ServiceCollectionExtensions
1010
{

src/Owl.reCAPTCHA/StringExtensions.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using System;
22
using System.Linq;
33

4-
namespace reCAPTCHA
4+
namespace Owl.reCAPTCHA
55
{
66
public static class StringExtensions
77
{

src/Owl.reCAPTCHA/reCAPTCHAConsts.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace reCAPTCHA
1+
namespace Owl.reCAPTCHA
22
{
33
public static class reCAPTCHAConsts
44
{

src/Owl.reCAPTCHA/reCAPTCHAOptions.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace reCAPTCHA
1+
namespace Owl.reCAPTCHA
22
{
33
public class reCAPTCHAOptions
44
{

src/Owl.reCAPTCHA/reCAPTCHASiteVerifyRequest.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace reCAPTCHA
1+
namespace Owl.reCAPTCHA
22
{
33
public class reCAPTCHASiteVerifyRequest
44
{

src/Owl.reCAPTCHA/reCAPTCHASiteVerifyResponse.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using System;
22
using Newtonsoft.Json;
33

4-
namespace reCAPTCHA
4+
namespace Owl.reCAPTCHA
55
{
66
public class reCAPTCHASiteVerifyResponse
77
{

src/Owl.reCAPTCHA/v2/IreCAPTCHASiteVerifyV2.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using System.Threading.Tasks;
22

3-
namespace reCAPTCHA.v2
3+
namespace Owl.reCAPTCHA.v2
44
{
55
public interface IreCAPTCHASiteVerifyV2
66
{

src/Owl.reCAPTCHA/v2/TagHelpers/reCAPTCHAV2DivTagHelper.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using Microsoft.AspNetCore.Razor.TagHelpers;
22
using Microsoft.Extensions.Options;
33

4-
namespace reCAPTCHA.V2.TagHelpers
4+
namespace Owl.reCAPTCHA.v2.TagHelpers
55
{
66
[HtmlTargetElement("recaptcha-div-v2", TagStructure = TagStructure.WithoutEndTag)]
77
public class reCAPTCHAV2DivTagHelper : TagHelper

src/Owl.reCAPTCHA/v2/TagHelpers/reCAPTCHAV2ElementTagHelper.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using Microsoft.AspNetCore.Razor.TagHelpers;
22
using Microsoft.Extensions.Options;
33

4-
namespace reCAPTCHA.V2.TagHelpers
4+
namespace Owl.reCAPTCHA.v2.TagHelpers
55
{
66
[HtmlTargetElement("*", Attributes = BadgeAttributeName)]
77
[HtmlTargetElement("*", Attributes = ThemeAttributeName)]

src/Owl.reCAPTCHA/v2/TagHelpers/reCAPTCHAV2ScriptTagHelper.cs

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
using System;
2-
using System.Globalization;
32
using Microsoft.AspNetCore.Html;
43
using Microsoft.AspNetCore.Razor.TagHelpers;
54
using Microsoft.Extensions.Options;
6-
using reCAPTCHA.v3;
75

8-
namespace reCAPTCHA.V2.TagHelpers
6+
namespace Owl.reCAPTCHA.v2.TagHelpers
97
{
108
[HtmlTargetElement("recaptcha-script-v2", TagStructure = TagStructure.WithoutEndTag)]
119
public class reCAPTCHAV2ScriptTagHelper : TagHelper

src/Owl.reCAPTCHA/v2/reCAPTCHASiteVerifyV2.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
using Microsoft.Extensions.Options;
66
using Newtonsoft.Json;
77

8-
namespace reCAPTCHA.v2
8+
namespace Owl.reCAPTCHA.v2
99
{
1010
public class reCAPTCHASiteVerifyV2 : IreCAPTCHASiteVerifyV2
1111
{

src/Owl.reCAPTCHA/v3/IreCAPTCHASiteVerifyV3.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using System.Threading.Tasks;
22

3-
namespace reCAPTCHA.v3
3+
namespace Owl.reCAPTCHA.v3
44
{
55
public interface IreCAPTCHASiteVerifyV3
66
{

src/Owl.reCAPTCHA/v3/TagHelpers/reCAPTCHAV3ScriptJsTagHelper.cs

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using Microsoft.AspNetCore.Razor.TagHelpers;
22
using Microsoft.Extensions.Options;
33

4-
namespace reCAPTCHA.v3.TagHelpers
4+
namespace Owl.reCAPTCHA.v3.TagHelpers
55
{
66
[HtmlTargetElement("recaptcha-script-v3-js", TagStructure = TagStructure.WithoutEndTag)]
77
public class reCAPTCHAV3ScriptJsTagHelper : TagHelper
@@ -21,20 +21,25 @@ public override void Process(TagHelperContext context, TagHelperOutput output)
2121
{
2222
/*
2323
grecaptcha.ready(function() {
24-
grecaptcha.execute('_reCAPTCHA_site_key_', {action: 'homepage'}).then(function(token) {
24+
grecaptcha.reExecute = function(){
25+
grecaptcha.execute('_reCAPTCHA_site_key_', {action: 'homepage'}).then(function(token) {
2526
...
26-
});
27+
})();
28+
}
2729
});
2830
*/
2931

3032
output.TagName = "script";
3133
output.TagMode = TagMode.StartTagAndEndTag;
3234

3335
var script = "grecaptcha.ready(function(){ " +
36+
"grecaptcha.reExecute = function(){" +
3437
"grecaptcha.execute('" + _options.SiteKey + "'" + (string.IsNullOrWhiteSpace(Action) ? "" : ",{action:'" + Action + "'}") + ")" +
3538
".then(function(token){" +
3639
Callback + "(token)" +
3740
"})" +
41+
"};" +
42+
"grecaptcha.reExecute()" +
3843
"});";
3944
output.Content.SetHtmlContent(script);
4045
}

src/Owl.reCAPTCHA/v3/TagHelpers/reCAPTCHAV3ScriptTagHelper.cs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
using System;
2-
using System.Globalization;
32
using Microsoft.AspNetCore.Html;
43
using Microsoft.AspNetCore.Razor.TagHelpers;
54
using Microsoft.Extensions.Options;
65

7-
namespace reCAPTCHA.v3.TagHelpers
6+
namespace Owl.reCAPTCHA.v3.TagHelpers
87
{
98
[HtmlTargetElement("recaptcha-script-v3", TagStructure = TagStructure.WithoutEndTag)]
109
public class reCAPTCHAV3ScriptTagHelper : TagHelper

src/Owl.reCAPTCHA/v3/reCAPTCHASiteVerifyV3.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
using Microsoft.Extensions.Options;
66
using Newtonsoft.Json;
77

8-
namespace reCAPTCHA.v3
8+
namespace Owl.reCAPTCHA.v3
99
{
1010
public class reCAPTCHASiteVerifyV3 : IreCAPTCHASiteVerifyV3
1111
{

src/Owl.reCAPTCHA/v3/reCAPTCHASiteVerifyV3Response.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace reCAPTCHA.v3
1+
namespace Owl.reCAPTCHA.v3
22
{
33
public class reCAPTCHASiteVerifyV3Response : reCAPTCHASiteVerifyResponse
44
{

0 commit comments

Comments
 (0)