source: main/trunk/model-interfaces-dev/heritage-nz/iframe/heritage-nz-dl_files/validationService.js@ 32796

Last change on this file since 32796 was 32796, checked in by davidb, 5 years ago

Initial set of files to provide look and feel of Heritage NZ site, plus SVN clickable map in an iframe

  • Property svn:executable set to *
File size: 1.2 KB
Line 
1(function (ng) {
2 angular.module('validation')
3 .factory('ValidateRecaptcha', ['$http', function ($http) {
4
5 var onloadCallback = function () {
6 grecaptcha.render('captcha_container', {
7 'sitekey': '6Ldx8wsTAAAAAB7nUzIibOEuwauMQg9B7QzsWvY8',// Public key
8 'callback': correctCaptcha,
9 });
10
11 };
12
13 var correctCaptcha = function (response) {
14 console.log(response);
15
16 $.ajax({
17 type: 'POST',
18 url: "/api/Validation/ReCaptcha",
19 data: "=" + response,
20 success: function (data) {
21 var res = JSON.parse(data);
22 console.log(res);
23 console.log(res.success);
24 if (res.success === true) {
25 return res;
26 }
27 }
28 });
29
30 };
31
32
33 return {
34 onloadCallback: onloadCallback,
35 correctCaptcha: correctCaptcha
36 };
37 }]);
38})(angular);
Note: See TracBrowser for help on using the repository browser.