Add reCaptcha for registration
This commit is contained in:
@@ -196,6 +196,10 @@
|
||||
<HintPath>..\packages\Owin.1.0\lib\net40\Owin.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="reCAPTCHA.MVC, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\reCAPTCH.MVC.1.0.1\lib\net45\reCAPTCHA.MVC.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="RestSharp, Version=104.1.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\RestSharp.104.1\lib\net4\RestSharp.dll</HintPath>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
@using OurUmbraco.Our.Controllers
|
||||
@using reCAPTCHA.MVC
|
||||
@inherits UmbracoViewPage<OurUmbraco.Our.Models.RegisterModel>
|
||||
@{
|
||||
Html.EnableClientValidation(true);
|
||||
@@ -60,6 +61,11 @@
|
||||
@Html.CheckBoxFor(m => m.AgreeTerms) <label for="AgreeTerms"><em>I agree to the <a href="/terms-and-conditions" target="_blank">terms and conditions</a> of using the Our Umbraco website.</em></label>
|
||||
@Html.ValidationMessageFor(m => m.AgreeTerms)
|
||||
</div>
|
||||
|
||||
<div class="profile-input" id="recaptcha">
|
||||
@Html.Recaptcha()
|
||||
@Html.ValidationMessage("ReCaptcha")
|
||||
</div>
|
||||
|
||||
<input class="button green" type="submit" value="Sign up">
|
||||
}
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
<package id="MySql.Data" version="6.9.8" targetFramework="net452" />
|
||||
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net452" />
|
||||
<package id="Owin" version="1.0" targetFramework="net452" />
|
||||
<package id="reCAPTCH.MVC" version="1.0.1" targetFramework="net452" />
|
||||
<package id="RestSharp" version="104.1" targetFramework="net4" />
|
||||
<package id="semver" version="1.1.2" targetFramework="net452" />
|
||||
<package id="SharpZipLib" version="0.86.0" targetFramework="net452" />
|
||||
|
||||
@@ -104,6 +104,10 @@
|
||||
<add key="GoogleOAuthClientID" value="it's a secret.. and no, this is not the secret, this key will transformed on the build server" />
|
||||
<add key="GoogleOAuthSecret" value="it's a secret.. and no, this is not the secret, this key will transformed on the build server" />
|
||||
<add key="HangFireEnabled" value="false" />
|
||||
|
||||
<!-- this reCaptcha key pair ONLY works on localhost and will be transformed on the build server -->
|
||||
<add key="reCaptchaPublicKey" value="6LdwJQ4UAAAAAL9hZdbodu7UHh9t6rV1reGyj2nX" />
|
||||
<add key="reCaptchaPrivateKey" value="6LdwJQ4UAAAAAISU06nHKXMx10WLnerO6jDEEDUD" />
|
||||
</appSettings>
|
||||
<connectionStrings>
|
||||
<remove name="umbracoDbDSN" />
|
||||
|
||||
@@ -6,6 +6,7 @@ using System.Web.Hosting;
|
||||
using System.Web.Mvc;
|
||||
using OurUmbraco.Our.Models;
|
||||
using OurUmbraco.Our.usercontrols;
|
||||
using reCAPTCHA.MVC;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.Models;
|
||||
@@ -26,6 +27,7 @@ namespace OurUmbraco.Our.Controllers
|
||||
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
[CaptchaValidator]
|
||||
public ActionResult HandleSubmit(RegisterModel model)
|
||||
{
|
||||
var locationInvalid = string.IsNullOrEmpty(model.Latitude) || string.IsNullOrEmpty(model.Longitude);
|
||||
|
||||
@@ -175,6 +175,10 @@
|
||||
<HintPath>..\packages\Owin.1.0\lib\net40\Owin.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="reCAPTCHA.MVC, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\reCAPTCH.MVC.1.0.1\lib\net45\reCAPTCHA.MVC.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="RestSharp, Version=104.1.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\RestSharp.104.1\lib\net4\RestSharp.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
<package id="MySql.Data" version="6.9.8" targetFramework="net452" />
|
||||
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net452" />
|
||||
<package id="Owin" version="1.0" targetFramework="net452" />
|
||||
<package id="reCAPTCH.MVC" version="1.0.1" targetFramework="net452" />
|
||||
<package id="RestSharp" version="104.1" targetFramework="net451" />
|
||||
<package id="semver" version="1.1.2" targetFramework="net452" />
|
||||
<package id="SharpZipLib" version="0.86.0" targetFramework="net452" />
|
||||
|
||||
Reference in New Issue
Block a user