How to add the CAPTCHA functionality in salesforce
2014-11-04 18:09
627 查看
A CAPTCHA (an acronym for “Completely Automated Public Turing test to tell Computers and Humans Apart”) is a type of challenge-response
test used in computing to determine whether or not the user is human. It uses the popular reCAPTCHA technology to implement the challenge.
There are times when we need to prevent the spam or garbage data filled by any anonymous then we need to use reCAPTCHA functionality. The reCAPTCHA looks like:
It contains random distorted images that is easily read by any human being.
We can use this in salesforce site etc. Lets take an example,a company provide a form for Enquiry, and if they needs protection from abuse, it is recommended that they use a reCAPTCHA. With this they ensure that a human was filling in a form before creating
a new request for them.
Here I am providing steps to use reCAPTCHA in salesforce :
Step 1 – First we need to get public and private key from the reCAPTCHA site to access this functionality.First we need to sign
up for a CAPTCHA key . After signing up we redirect to the “Create a reCAPTCHA key” page and here you need to enter domail URL and check the “Enable this key on all domains (global key)” option to make it global key which is used by any domain and create
keys .To proceed this way you got your public and private key which is further used in apex and VF page.
Step 2 – Now you need to add at remote site setting by which salesforce can invoke code from that particular site.
Go to the Setup -> Security Controls -> Remote Site Settings. And add the following URL :https://www.google.com.
Step
3- Now you have reCAPTCHA key as well as you added remote site settings. At last you need to write down code to achieve the reCAPTCHA functionality.
Apex Code :
In the above code we need to make a HTTP post with challenge,response ,private key as a parameter to reCAPTCHA site in the “verifyAndSubmit” method and the response body contains ‘true’ if the challenge and response is equal otherwise contain false.
And the Visual force page code is:
In the VF we need to pass public key to create reCAPTCHA.
test used in computing to determine whether or not the user is human. It uses the popular reCAPTCHA technology to implement the challenge.
There are times when we need to prevent the spam or garbage data filled by any anonymous then we need to use reCAPTCHA functionality. The reCAPTCHA looks like:
It contains random distorted images that is easily read by any human being.
We can use this in salesforce site etc. Lets take an example,a company provide a form for Enquiry, and if they needs protection from abuse, it is recommended that they use a reCAPTCHA. With this they ensure that a human was filling in a form before creating
a new request for them.
Here I am providing steps to use reCAPTCHA in salesforce :
Step 1 – First we need to get public and private key from the reCAPTCHA site to access this functionality.First we need to sign
up for a CAPTCHA key . After signing up we redirect to the “Create a reCAPTCHA key” page and here you need to enter domail URL and check the “Enable this key on all domains (global key)” option to make it global key which is used by any domain and create
keys .To proceed this way you got your public and private key which is further used in apex and VF page.
Step 2 – Now you need to add at remote site setting by which salesforce can invoke code from that particular site.
Go to the Setup -> Security Controls -> Remote Site Settings. And add the following URL :https://www.google.com.
Step
3- Now you have reCAPTCHA key as well as you added remote site settings. At last you need to write down code to achieve the reCAPTCHA functionality.
Apex Code :
And the Visual force page code is:
相关文章推荐
- [Android 問題] How to Add a Button in ListView, and Make the Event of onClick and onItemClick Coexist?
- SiteMap Controls: How to add a duplicate link in the web.sitemap
- How to hide an entry in the Add/Remove Programs applet?
- How to add the cracked dlls in GAC---let me tell u
- How to add a button in the seletions "More"
- SiteMap Controls: How to add a duplicate link in the web.sitemap
- How to add the cracked dlls in GAC---let me tell u
- [Drupal] How to add the js file and js code block in Drupal
- How can I force Python's file.write() to use the same newline format in Windows as in Linux (“\r\n”
- How to add the patch in apache community?
- How to add ComboBox control to the ToolBar control in VC - 如何在VC中向ToolBar控件加入ComboBox控件
- How To Add Menus to the Menubar in Cocoa
- R12: How to add Microsoft Excel as Type to the Create Template List of Values in BI Publisher (Doc ID 1343225.1)
- How To Add/Increase The Size Of Redo Log Files In Rac Environment? (文档 ID 779306.1)
- How to add the cracked dlls in GAC---let me tell u
- How to add the cracked dlls in GAC and How to release
- What 's CATT(Computer Aided Test Tool)?How to deal with the CATT in the SAP System?什么是CATT(计算机附加测试工具)
- How to Access the DOM(Document Object Model) in MOSS 2007
- How to treat the stress in a appropriate way
- [总结]How to Shoot Yourself In the Foot