Copied to clipboard

Flag this post as spam?

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


  • Laurin 14 posts 134 karma points
    Feb 09, 2023 @ 14:00
    Laurin
    0

    Recaptcha Keys in Appsettings

    I use Umbraco Forms with the built in Recaptcha v3. when i put the keys in UmbracoForms.config it works fine.
    I tried to put my Keys in the Appsettings.config. I found, where the Sitekey is called, but not the Privatekey.
    In \Views\Partials\Forms\Themes\default\FieldTypes\FieldType.Recaptcha3.cshtml you can get the key from the Appsettings via ConfigurationManager.AppSettings["RecaptchaV3SiteKey"];
    I want to do the same with the private Key, where is the forms getting the key in UmbracoForms.config?

    When I try to fill out a form with the keys in Appsettings, I get the error

    The Google reCAPTCHA failed to validate your submission

  • Sebastiaan Janssen 5061 posts 15544 karma points MVP admin hq
    Feb 10, 2023 @ 07:58
    Sebastiaan Janssen
    0

    Not in UmbracoForms.config, you put them in your appSettings: https://docs.umbraco.com/umbraco-forms/editor/creating-a-form/fieldtypes/recaptcha3/

  • Laurin 14 posts 134 karma points
    Feb 10, 2023 @ 12:41
    Laurin
    0

    I'm using Umbraco v8, there you have to put it in UmbracoForms.conig

  • Sebastiaan Janssen 5061 posts 15544 karma points MVP admin hq
    Feb 11, 2023 @ 07:42
  • Sebastiaan Janssen 5061 posts 15544 karma points MVP admin hq
    Feb 11, 2023 @ 07:43
    Sebastiaan Janssen
    0

    I think I misunderstood the question, are you saying you can't get the private key from the configurationmanager?

  • Laurin 14 posts 134 karma points
    Feb 13, 2023 @ 09:36
    Laurin
    0

    Yes, you misunderstood the question
    The Recaptcha is working with the Keys in UmbracoForms.config. but I want them in appsettings.config to have different Keys in production and development. It works with the sitekey, but not with the privatekey

  • Sebastiaan Janssen 5061 posts 15544 karma points MVP admin hq
    Feb 13, 2023 @ 10:29
    Sebastiaan Janssen
    100

    I don't think that is possible at the moment, but on the short term you could set up a config transform during your build to replace the keys in the UmbracoForms.config file.

    Alternatively, you could use this package https://our.umbraco.com/packages/website-utilities/recaptcha-v3-for-umbraco-forms/ or your own implementation of a fieldtype (the source for this package is available for inspiration).

    You could creating an issue for this feature request here: https://github.com/umbraco/Umbraco.Forms.Issues/issues/new/choose

    However, to set some expectations though: since this is something that's never been requested before in all the time this setup has existed, plus the fact that there are other ways to do this, I doubt it will be picked up by the Forms team any time soon.

  • 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