hari-p
1/23/2017 - 9:51 PM

Recapth site verify

Recapth site verify

 @Override
    public JSONObject getRecaptchVerification(String response) {
        URI uri = null;
        try {
            uri = new URI("https","www.google.com", "/recaptcha/api/siteverify",null,null);
            URL url = uri.toURL();
            LOG.info("url for google captch:", url.toString());
            Response<JSONObject> result = Webb.create().post(url.toString())
                    .param("secret", "6LeL-ggggggddsshhjj")
                    .param("response", response)
                    .body("test").asJsonObject();
            JSONObject job = result.getBody();
            return job;
        } catch (Exception e) {
           LOG.error("getRecaptchVerification exception", e);
        }


        return null;
    }
 function($scope, $rootScope, $http, fileUpload, Upload, $timeout, ENV, recaptcha) {

        $scope.setWidgetId = function (widgetId) {
            // store the `widgetId` for future usage.
            // For example for getting the response with
            // `recaptcha.getResponse(widgetId)`.
        };

        $scope.setResponse = function (response) {
            $http.get(ENV.apiEndpoint + '/rest/recaptchVerification', {
                params: {
                    apiToken: ENV.apiToken,
                    response:response
                }
            }).success(function() {
                alert('got successful response from google:'  );
            })
                .error(function() {
                    alert('got unsuccessful response from google:' );
                    new HandleError();
                });
        };


        $scope.cbExpiration = function() {
            // reset the 'response' object that is on scope
        };
        $scope.issue = {};