Google Recapcha v3: use same key in different forms in the same domain - recaptcha-v3

Quick question: I have on a website 3 different contact forms for different languages. All 3 forms point to the same PHP script which processes the data and sends it to us via email.
Can I use the same Google Recaptcha v3 key for the 3 forms, or do I have to create different ones?
Also, this is an exceedingly silly question, but just in case: I have seen some sample code where they added a hidden field in the form for the recaptcha response:
<input type="hidden" name="recaptcha_response" id="recaptchaResponse">
From what I understand in the docs, this isn't needed anymore in V3. Instead, you can name the button "g-recaptcha" and capture in the PHP form the $_POST["g-recaptcha"] variable:
<button class="g-recaptcha" data-sitekey="mykey" data-callback='onSubmit' data-action='submit'>
Can anyone confirm that this is the case?
Thanks.

Related

Storing and retrieving data for custom Shopify apps

So I am trying to build something for my store but a few things are somewhat unclear.
If I need to save some user settings do I need my own backend just
for that app specifically? For simplicity sake, I want build an app
to save and display a custom message in cart-template.liquid.To
achieve that, I think my app should make a request to my backend (let
say, on heroku) and save it in some db that app is using?
How do I retrieve that data in cart-template.liquid? I guess I
build a snippet that calls a public endpoint of my backend that
returns that saved message using fetch() or maybe axios.get and
embed it using {% render 'fetch-custom-message-snippet' %} ?
Say I ask for user input, ie. "Engraved message" and the form is in cart-template.liquid,
of course. The following snippet is used:
<p class="line-item-property__field">
<label for="engraved-message">Engraved message</label>
<input id="engraved-message" type="text" name="properties[Engraved message]">
</p>
How do I make sure that bit of information is captured and passed to me? I guess I want to see it somewhere in the order details.
If I need to save some user settings do I need my own backend just for that app specifically? For simplicity sake, I want build an app to save and display a custom message in cart-template.liquid.To achieve that, I think my app should make a request to my backend (let say, on heroku) and save it in some db that app is using?
Yes, you need your own backend. Your application alone is responsible for storing its own information (there are some exceptions like a special order field which I show you below) - that typically infers a database that back ups your service and holds your data. Please check out this thread as you can find lots of valuable information there.
Regarding cart-template.liquid I'd suggest taking a look at the official "Shopify Developers" documentation. All information you're allowed to display and request are neatly explained and ordered there.
How do I retrieve that data in cart-template.liquid? I guess I build a snippet that calls a public endpoint of my backend that returns that saved message using fetch() or maybe axios.get and embed it using {% render 'fetch-custom-message-snippet' %} ?
Once again there are good guides out there. I suggest taking a look at this blog post which goes into in-depth on this topic. Shopify's documentation about the Liquid template language is also highly advised to be read.
How do you retrieve that data? According to this specific example any input will be supplied to your order page in the Shopify admin. For example:
<label for="CartNote">Special instructions</label>
<textarea name="note" id="CartNote">{{ cart.note }}</textarea>
*taken from https://shopify.github.io/liquid-code-examples/example/cart-notes*; shows a Special instruction label and textarea for users to submit details about the oder - you will get this data on, as mentioned, the order page in the Shopify admin.
Say I ask for user input, ie. "Engraved message" and the form is in
cart-template.liquid, of course. The following snippet is used:
[...] How do I make sure that bit of information is captured and passed to me? I guess I want to see it somewhere in the order details.
see above
//EDIT:
To prevent any confusion: It seems like you want to develop a custom app just for personal usage and not to publish it in the Shopify App Store - in this case you most often than not don't need an external database; e.g. the example you provided with a simple order request which is easily doable through Shopify's examples.
For your specific case this code snippet (I modified your original example to fit the case - it's not a full cart-template.liquid obviously; in this case the file is called cart.liquid):
<label for="engraved-message">Engraved message</label>
<textarea name="message" id="engraved-message">{{ cart.note }}</textarea>
//EDIT 2:
The link - shared by another user in this thread, namely #Simas Butavičius - is actually kind of useful if you have problems with the customization process in general, i.e. if you want to revise some basic concepts or want to check how to implement the code snippet from above in the whole structure of your website I'd advise to skim through this site.
Needless to say, there are hundreds of good tutorials, questions regarding the same "issue" or other resources in general.
I suggest for further reading purposes to check out some of these links and guides (some may be mentioned above):
https://shopify.github.io/liquid-code-examples/example/cart-notes
https://shopify.github.io/liquid-code-examples/example/checkout-form (! very good in-depth example)
https://www.christhefreelancer.com/shopify-liquid-guide/
https://shopify.dev/docs/themes/theme-templates/cart-liquid
https://shopify.dev/docs/themes/liquid/reference
https://www.shopify.com/partners/shopify-cheat-sheet (! helpful cheatsheet)
https://community.shopify.com/c/Shopify-Design/Cart-Use-cart-attributes-to-collect-more-information/td-p/613718
https://community.shopify.com/c/Shopify-APIs-SDKs/Add-custom-input-fields-to-cart/td-p/154710
https://community.shopify.com/c/Shopify-Design/Product-pages-Get-customization-information-for-products/td-p/616503
Here is the tutorial specifically for creating custom shopify input field for getting engraving information: https://community.shopify.com/c/Shopify-Design/Product-pages-Get-customization-information-for-products/td-p/616503

Twitter -- Tracking single user's tweet using API

I am having a hard time solving this dilemma, and I have a feeling that it's been done a million times, I just cannot find any documentation on it. What I am trying to do:
I have a button on my site that pops open a Twitter window and allows a user to tweet a reformatted message that I have defined.
<a onclick="window.open('https://twitter.com/intent/tweet?original_referer=<?php echo $_page_url?>&source=tweetbutton&text=<?php echo $tweet_message ?>&url=<?php echo $_page_url?>', '', 'height=500,width=650,modal=yes,alwaysRaised=yes resizable=1 scrollbars=1');">
<img src="/share/twitter_share.png" alt="share now" width="94" height="23" />
</a>
What I am needing is a way of tracking if this person has successfully tweeted this message and the user id or username returned for storage in a database. The reason for this is that I want them entered in this database ONCE. We are having a giveaway based on a single share/tweet, and they only get one entry per username/id.
I have tried multiple ways to retrieve the ID or username of current logged in user, mostly using the https://api.twitter.com/ to return JSON to no avail. I have also read the following:
https://dev.twitter.com/docs/platform-objects/users
https://dev.twitter.com/docs/platform-objects/tweets
And am now stuck. All I need is a return for user id that I can attach to the above window. Does anyone know how I can accomplish this? Thanks!
It cannot be done using this approach, at least not with true certainity. All you can do is track if 1) the window was successfully open using onclick and 2) if the window was closed (you can assume that perhaps the user completed the tweet).
You will NOT able to get ANY information from you open window via Javascript because the window is NOT in your domain (meaning, it is not on your server but on Twitter's).
What you want to do is implement this functionality in code as opposed to a javascript popup window. I have seen a number of commerical products that do exactly what you are describing.
The documentation (links) you provided refer to the REST API for Twitter (which usually works on the server) that is VERY different from Twitter's Web Intents which is client site javascript plugin, which has no similar API.

Required fields in Mechanical Turk

Is there any way to make fields required in an Amazon Mechanical Turk HIT? I get some blank responses to the textboxes or radiobuttons in my HTML form and the Amazon's documentation doesn't seem to provide any mechanism for validation.
The easiest way would probably be to use Amazon's API call 'createHIT' to create your HIT: http://docs.amazonwebservices.com/AWSMechTurk/latest/AWSMturkAPI/index.html?ApiReference_CreateHITOperation.html
Then, you can specify your HIT questions using a 'questionForm' data structure, which allows defining any field as 'required', and enforces it when the form is submitted.
I think adding the required attribute to your element works fine.
<input class="form-control" id="url" name="url" placeholder="Enter URL here" required="" type="url" />
I would suggest you create your HIT on an external server, used javascript for form validation and then display the questionnaire on Mechanical Turk using an iFrame.
If you don't mind creating an external web app to host your question form, you can create an external HIT and do your validation there.

Authorize.net SIM Process w/Master Pages using VB.NET returns Error 13 Invalid User

I am trying to use Authorize.net's SIM payment gateway process and am using the base code provided on the developer site. The problem is I am using Master Pages with my site and the hidden field names are getting concatenated with the nested control IDs as an example:
This is what the field should look like:
<input type="hidden" runat="server" name="x_login" id="x_login" />
The output ends up looking like:
<input name="ctl00$MainContent$x_login" type="hidden" id="ctl00_MainContent_x_login" value="MyCode" />
Normally that would not be a problem except Authorize.net is picky about field names apparently since I keep getting Error 13 invalid user. I went through their forums and opened a customer support ticket a week ago, no response other than the automated check our forums email. The closest thing I found on their forums is other people with Master Pages having the same problem with no answers.
I also used their developer response site to check out the values that I am sending them and they all seem to be correct, including the field names. I am at a loss. I can post the entire subset of code but it is the code from their site pasted into my contentholder.
The other work around I have is since my Masterpage already has a form I added these lines of code:
Me.Form.Action = "https://test.authorize.net/gateway/transact.dll"
'Me.Form.Action = "https://developer.authorize.net/tools/paramdump/index.php" This link will show all of the form elements that are submitted.
Me.Form.Method = "Post"
The above lines seem to work properly as the output code looks correct.
Finding no help anywhere else I thought I would ask the people who have not let me down yet.
Here is the answer. After trying a lot of different paths, it is definitely the MasterPage that frags the post to Authorize.net. I tried re-"name"ing the controls among several other things and for time conisderations I gave up trying to resolve the issue and just reformatted the page to not use my masterpage file. I am also building a silverlight e-commerce solution and I am a little concerned that I will not be able to use authorize.net for the same reason.

Does Google follow Buttons/Inputs

Does google follow buttons and form inputs when crawling websites? I'm adding rel="nofollow" tags to links I don't want google to follow but I'm not sure if I need to add them to buttons.
For example an 'add to cart' button.
Thanks
Generally, no. Especially not POST-based forms; POST may have side-effects per the RFC, while GET is defined as a "safe" method. Google is experimenting with some "deep web" spidering, however, so it's possible that they may request GET-based forms -- but this isn't yet commonplace, as far as I know.
But according to the standards, spiders should not POST.
In fact, the original announcement from google states that they only follow GET-based forms.
Your "add to cart" button should either POST a form, or execute JavaScript. Google won't do either of those two things.
hi bots don't submit post requests of any kind.
google does follow rel=nofollow links, it just doesn't assume that you are 'vouching' for the content to which they link