Skip to content

Commit

Permalink
Merge pull request maliming#2 from maliming/dev
Browse files Browse the repository at this point in the history
0.3.0
  • Loading branch information
maliming authored Apr 11, 2020
2 parents 5cf68ae + a2657b3 commit bf59987
Showing 31 changed files with 53 additions and 61 deletions.
6 changes: 1 addition & 5 deletions demo/reCAPTCHA.Demo/Pages/Error.cshtml.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.Logging;

namespace reCAPTCHA.Tests.Pages
namespace reCAPTCHA.Demo.Pages
{
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
public class ErrorModel : PageModel
9 changes: 2 additions & 7 deletions demo/reCAPTCHA.Demo/Pages/Index.cshtml.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.Logging;

namespace reCAPTCHA.Tests.Pages
namespace reCAPTCHA.Demo.Pages
{
public class IndexModel : PageModel
{
9 changes: 2 additions & 7 deletions demo/reCAPTCHA.Demo/Pages/Privacy.cshtml.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.Logging;

namespace reCAPTCHA.Tests.Pages
namespace reCAPTCHA.Demo.Pages
{
public class PrivacyModel : PageModel
{
2 changes: 1 addition & 1 deletion demo/reCAPTCHA.Demo/Pages/V2_Checkbox.cshtml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@page
@model reCAPTCHA.Tests.Pages.V2_CheckboxModel
@model reCAPTCHA.Demo.Pages.V2_CheckboxModel
@{
ViewData["Title"] = "V2_Checkbox";
}
5 changes: 3 additions & 2 deletions demo/reCAPTCHA.Demo/Pages/V2_Checkbox.cshtml.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Newtonsoft.Json;
using reCAPTCHA.v2;
using Owl.reCAPTCHA;
using Owl.reCAPTCHA.v2;

namespace reCAPTCHA.Tests.Pages
namespace reCAPTCHA.Demo.Pages
{
public class V2_CheckboxModel : PageModel
{
4 changes: 2 additions & 2 deletions demo/reCAPTCHA.Demo/Pages/V2_Invisible.cshtml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@page
@model reCAPTCHA.Tests.Pages.V2_InvisibleModel
@page
@model reCAPTCHA.Demo.Pages.V2_InvisibleModel
@{
ViewData["Title"] = "V2_Invisible";
}
5 changes: 3 additions & 2 deletions demo/reCAPTCHA.Demo/Pages/V2_Invisible.cshtml.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Newtonsoft.Json;
using reCAPTCHA.v2;
using Owl.reCAPTCHA;
using Owl.reCAPTCHA.v2;

namespace reCAPTCHA.Tests.Pages
namespace reCAPTCHA.Demo.Pages
{
public class V2_InvisibleModel : PageModel
{
6 changes: 3 additions & 3 deletions demo/reCAPTCHA.Demo/Pages/V3.cshtml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@page
@page
@using Microsoft.Extensions.Options
@using reCAPTCHA.v3
@model reCAPTCHA.Tests.Pages.V3Model
@using Owl.reCAPTCHA
@model reCAPTCHA.Demo.Pages.V3Model
@inject IOptions<reCAPTCHAOptions> Options
@{
ViewData["Title"] = "V3";
5 changes: 3 additions & 2 deletions demo/reCAPTCHA.Demo/Pages/V3.cshtml.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Newtonsoft.Json;
using reCAPTCHA.v3;
using Owl.reCAPTCHA;
using Owl.reCAPTCHA.v3;

namespace reCAPTCHA.Tests.Pages
namespace reCAPTCHA.Demo.Pages
{
public class V3Model : PageModel
{
3 changes: 1 addition & 2 deletions demo/reCAPTCHA.Demo/Pages/_ViewImports.cshtml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@using reCAPTCHA.Tests
@namespace reCAPTCHA.Tests.Pages
@namespace reCAPTCHA.Demo.Pages
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@addTagHelper *, Owl.reCAPTCHA
2 changes: 1 addition & 1 deletion demo/reCAPTCHA.Demo/Program.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;

namespace reCAPTCHA.Tests
namespace reCAPTCHA.Demo
{
public class Program
{
3 changes: 2 additions & 1 deletion demo/reCAPTCHA.Demo/Startup.cs
Original file line number Diff line number Diff line change
@@ -3,8 +3,9 @@
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Owl.reCAPTCHA;

namespace reCAPTCHA.Tests
namespace reCAPTCHA.Demo
{
public class Startup
{
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Globalization;

namespace reCAPTCHA
namespace Owl.reCAPTCHA
{
public class CultureInforeCAPTCHALanguageCodeProvider : IreCAPTCHALanguageCodeProvider
{
2 changes: 1 addition & 1 deletion src/Owl.reCAPTCHA/IreCAPTCHALanguageCodeProvider.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace reCAPTCHA
namespace Owl.reCAPTCHA
{
public interface IreCAPTCHALanguageCodeProvider
{
3 changes: 2 additions & 1 deletion src/Owl.reCAPTCHA/Owl.reCAPTCHA.csproj
Original file line number Diff line number Diff line change
@@ -9,10 +9,11 @@
<PackageProjectUrl>https://github.com/maliming/reCAPTCHA</PackageProjectUrl>
<RepositoryUrl>https://github.com/maliming/reCAPTCHA</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<Version>0.2.0</Version>
<Version>0.3.0</Version>
<IsPackable>true</IsPackable>
<OutputType>Library</OutputType>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<!-- including PDB files in NuGet for source link because symbolsource.org does not support portable PDBs -->
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
</PropertyGroup>
6 changes: 3 additions & 3 deletions src/Owl.reCAPTCHA/ServiceCollectionExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using System;
using System.Net.Http;
using Microsoft.Extensions.DependencyInjection;
using reCAPTCHA.v2;
using reCAPTCHA.v3;
using Owl.reCAPTCHA.v2;
using Owl.reCAPTCHA.v3;

namespace reCAPTCHA
namespace Owl.reCAPTCHA
{
public static class ServiceCollectionExtensions
{
2 changes: 1 addition & 1 deletion src/Owl.reCAPTCHA/StringExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System;
using System.Linq;

namespace reCAPTCHA
namespace Owl.reCAPTCHA
{
public static class StringExtensions
{
2 changes: 1 addition & 1 deletion src/Owl.reCAPTCHA/reCAPTCHAConsts.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace reCAPTCHA
namespace Owl.reCAPTCHA
{
public static class reCAPTCHAConsts
{
2 changes: 1 addition & 1 deletion src/Owl.reCAPTCHA/reCAPTCHAOptions.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace reCAPTCHA
namespace Owl.reCAPTCHA
{
public class reCAPTCHAOptions
{
2 changes: 1 addition & 1 deletion src/Owl.reCAPTCHA/reCAPTCHASiteVerifyRequest.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace reCAPTCHA
namespace Owl.reCAPTCHA
{
public class reCAPTCHASiteVerifyRequest
{
2 changes: 1 addition & 1 deletion src/Owl.reCAPTCHA/reCAPTCHASiteVerifyResponse.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System;
using Newtonsoft.Json;

namespace reCAPTCHA
namespace Owl.reCAPTCHA
{
public class reCAPTCHASiteVerifyResponse
{
2 changes: 1 addition & 1 deletion src/Owl.reCAPTCHA/v2/IreCAPTCHASiteVerifyV2.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Threading.Tasks;

namespace reCAPTCHA.v2
namespace Owl.reCAPTCHA.v2
{
public interface IreCAPTCHASiteVerifyV2
{
2 changes: 1 addition & 1 deletion src/Owl.reCAPTCHA/v2/TagHelpers/reCAPTCHAV2DivTagHelper.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Microsoft.AspNetCore.Razor.TagHelpers;
using Microsoft.Extensions.Options;

namespace reCAPTCHA.V2.TagHelpers
namespace Owl.reCAPTCHA.v2.TagHelpers
{
[HtmlTargetElement("recaptcha-div-v2", TagStructure = TagStructure.WithoutEndTag)]
public class reCAPTCHAV2DivTagHelper : TagHelper
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Microsoft.AspNetCore.Razor.TagHelpers;
using Microsoft.Extensions.Options;

namespace reCAPTCHA.V2.TagHelpers
namespace Owl.reCAPTCHA.v2.TagHelpers
{
[HtmlTargetElement("*", Attributes = BadgeAttributeName)]
[HtmlTargetElement("*", Attributes = ThemeAttributeName)]
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
using System;
using System.Globalization;
using Microsoft.AspNetCore.Html;
using Microsoft.AspNetCore.Razor.TagHelpers;
using Microsoft.Extensions.Options;
using reCAPTCHA.v3;

namespace reCAPTCHA.V2.TagHelpers
namespace Owl.reCAPTCHA.v2.TagHelpers
{
[HtmlTargetElement("recaptcha-script-v2", TagStructure = TagStructure.WithoutEndTag)]
public class reCAPTCHAV2ScriptTagHelper : TagHelper
2 changes: 1 addition & 1 deletion src/Owl.reCAPTCHA/v2/reCAPTCHASiteVerifyV2.cs
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@
using Microsoft.Extensions.Options;
using Newtonsoft.Json;

namespace reCAPTCHA.v2
namespace Owl.reCAPTCHA.v2
{
public class reCAPTCHASiteVerifyV2 : IreCAPTCHASiteVerifyV2
{
2 changes: 1 addition & 1 deletion src/Owl.reCAPTCHA/v3/IreCAPTCHASiteVerifyV3.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Threading.Tasks;

namespace reCAPTCHA.v3
namespace Owl.reCAPTCHA.v3
{
public interface IreCAPTCHASiteVerifyV3
{
11 changes: 8 additions & 3 deletions src/Owl.reCAPTCHA/v3/TagHelpers/reCAPTCHAV3ScriptJsTagHelper.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Microsoft.AspNetCore.Razor.TagHelpers;
using Microsoft.Extensions.Options;

namespace reCAPTCHA.v3.TagHelpers
namespace Owl.reCAPTCHA.v3.TagHelpers
{
[HtmlTargetElement("recaptcha-script-v3-js", TagStructure = TagStructure.WithoutEndTag)]
public class reCAPTCHAV3ScriptJsTagHelper : TagHelper
@@ -21,20 +21,25 @@ public override void Process(TagHelperContext context, TagHelperOutput output)
{
/*
grecaptcha.ready(function() {
grecaptcha.execute('_reCAPTCHA_site_key_', {action: 'homepage'}).then(function(token) {
grecaptcha.reExecute = function(){
grecaptcha.execute('_reCAPTCHA_site_key_', {action: 'homepage'}).then(function(token) {
...
});
})();
}
});
*/

output.TagName = "script";
output.TagMode = TagMode.StartTagAndEndTag;

var script = "grecaptcha.ready(function(){ " +
"grecaptcha.reExecute = function(){" +
"grecaptcha.execute('" + _options.SiteKey + "'" + (string.IsNullOrWhiteSpace(Action) ? "" : ",{action:'" + Action + "'}") + ")" +
".then(function(token){" +
Callback + "(token)" +
"})" +
"};" +
"grecaptcha.reExecute()" +
"});";
output.Content.SetHtmlContent(script);
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
using System;
using System.Globalization;
using Microsoft.AspNetCore.Html;
using Microsoft.AspNetCore.Razor.TagHelpers;
using Microsoft.Extensions.Options;

namespace reCAPTCHA.v3.TagHelpers
namespace Owl.reCAPTCHA.v3.TagHelpers
{
[HtmlTargetElement("recaptcha-script-v3", TagStructure = TagStructure.WithoutEndTag)]
public class reCAPTCHAV3ScriptTagHelper : TagHelper
2 changes: 1 addition & 1 deletion src/Owl.reCAPTCHA/v3/reCAPTCHASiteVerifyV3.cs
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@
using Microsoft.Extensions.Options;
using Newtonsoft.Json;

namespace reCAPTCHA.v3
namespace Owl.reCAPTCHA.v3
{
public class reCAPTCHASiteVerifyV3 : IreCAPTCHASiteVerifyV3
{
2 changes: 1 addition & 1 deletion src/Owl.reCAPTCHA/v3/reCAPTCHASiteVerifyV3Response.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace reCAPTCHA.v3
namespace Owl.reCAPTCHA.v3
{
public class reCAPTCHASiteVerifyV3Response : reCAPTCHASiteVerifyResponse
{

0 comments on commit bf59987

Please sign in to comment.