Skip to content

Commit

Permalink
Added default fieldtype
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaron committed May 4, 2020
1 parent 234482c commit d9c2e39
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions Views/Partials/Forms/Fieldtypes/Fieldtype.hCaptcha.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
@using UmbracoForms.HCaptcha
@model Umbraco.Forms.Mvc.Models.FieldViewModel
@{
var siteKey = AppSettingsManager.GethCaptchaSiteKey();
var theme = "light";
var themeSetting = Model.AdditionalSettings.FirstOrDefault(x => x.Key == "Theme");
if (themeSetting.Value != "")
{
theme = themeSetting.Value;
}
var size = "normal";
var sizeSetting = Model.AdditionalSettings.FirstOrDefault(x => x.Key == "Size");
if (sizeSetting.Value != "")
{
size = sizeSetting.Value;
}

if (!string.IsNullOrEmpty(siteKey))
{
<script src="https://hcaptcha.com/1/api.js" async defer></script>
<div class="h-captcha" data-sitekey="@siteKey" data-theme="@theme" data-size="@size"></div>
}
else
{
<p class="error">ERROR: hCaptcha is missing the Site Key - Please update the web.config to include 'key="hCaptchaSiteKey"'</p>
}
}

0 comments on commit d9c2e39

Please sign in to comment.