Last active
August 29, 2015 14:10
-
-
Save dkumar431/9432e0c6dee3a5141b0c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfparam name="FORM.username" default="" type="string" > | |
<cfparam name="FORM.password" default="" type="string" > | |
<cfif structKeyExists(FORM,"submit")> | |
<cfset recaptcha = FORM["g-recaptcha-response"] > | |
<cfif len(recaptcha)> | |
<cfset googleUrl = "https://www.google.com/recaptcha/api/siteverify"> | |
<cfset secret = "6LctadUSAAAAAM7NPoPq5jlbm3a37ib3sHlRFyNE"> | |
<cfset ipaddr = CGI.REMOTE_ADDR> | |
<cfset request_url = googleUrl & "?secret=" & secret & "&response=" & recaptcha & "&remoteip" & ipaddr> | |
<cfhttp url="#request_url#" method="get" timeout="10"> | |
<cfset response = deserializeJSON(cfhttp.filecontent)> | |
<cfif response.success eq "YES"> | |
<!--- Start validating the username/password here. ---> | |
</cfif> | |
</cfif> | |
</cfif> | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src='https://www.google.com/recaptcha/api.js'></script> | |
</head> | |
<body> | |
<form method="post"> | |
UserName: | |
<input type="text" name="username"> | |
<br><br> | |
Password: | |
<input type="password" name="password"> | |
<br><br> | |
<div class="g-recaptcha" data-sitekey="6LctadUSAAAAAI81jKmWaBFGWwMky64xbBGhVl8L"></div> | |
<input type="submit" value="Submit" name="submit"> | |
</form> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Could not get this work. I got
Element G is undefined in FORM.
error :( Can you help ?