Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Tom Johnstone 3 posts 73 karma points
    Nov 12, 2019 @ 14:45
    Tom Johnstone
    0

    ReCapture resulting in mixed content error for HTTP and HTTPS

    Added google Recapture to a contact form on Umbraco and have put the public and privtate keys into the UmbracoForms.config file but when i load the web page the error:

    Mixed Content: The page at 'https://-' was loaded over HTTPS, but requested an insecure script 'http://www.google.com/recaptcha/api/challenge?k=6LeqoNsSAAAAAOQrdqDFE5KAzDESxxxODLpOeJjh&hl=&'. This request has been blocked; the content must be served over HTTPS.

    How do i fix this in the Umbraco admin console or the source code?

  • Amir Khan 1289 posts 2746 karma points
    Nov 12, 2019 @ 15:24
    Amir Khan
    0

    I've never encountered that before but give this file a look, the script is called from there: Views/Partials/Forms/Fieldtypes/FieldType.Recaptcha2.cshtml

  • Tom Johnstone 3 posts 73 karma points
    Nov 12, 2019 @ 15:57
    Tom Johnstone
    0

    This file contains the following:

    @using System.Runtime.CompilerServices
    @using Umbraco.Forms.Mvc.Helpers
    @model Umbraco.Forms.Mvc.Models.FieldViewModel
    @{
    var theme = "clean";
    if (Model.AdditionalSettings.Any(x => x.Key == "Theme")) {
        theme = Model.AdditionalSettings.FirstOrDefault(x => x.Key == "Theme").Value;
        }
    }
    @ReCaptchaHelper.ReCaptcha(theme)
    

    Any idea where the http call to google might come from?

  • Amir Khan 1289 posts 2746 karma points
    Nov 12, 2019 @ 16:01
    Amir Khan
    0

    Hmm, for me that file contains the following (among other things), just checked another site also. They are both v7 sites...What version of Umbraco are you using?

     if (!string.IsNullOrEmpty(siteKey))
        {
            <script src="https://www.google.com/recaptcha/api.js" async defer></script>
            <div class="g-recaptcha" data-sitekey="@siteKey" data-theme="@theme" data-size="@size"></div>
        }
    
  • Amir Khan 1289 posts 2746 karma points
    Nov 12, 2019 @ 16:02
    Amir Khan
    0

    Maybe look in the theme folder at Form.cshtml, Script.cshtml or Render.cshtml also.

  • Jonathan Distenfeld 105 posts 618 karma points
    Nov 13, 2019 @ 08:35
    Jonathan Distenfeld
    0

    Hi,

    you should always have SSL enabled! This would also fix the issue. Anyway, for testing purposes you could try following (untested).

    for Fieldtype.Recaptcha:

    @MvcHtmlString.Create(ReCaptchaHelper.ReCaptcha(theme).ToString().Replace("https://", "http://"))
    

    for Fieldtype.Recaptcha2:

    <script src="http://www.google.com/recaptcha/api.js" async defer></script>
    

    ~ Jonathan

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies