VividCortex / angular-recaptcha

AngularJS directive to add a reCaptcha widget to your form
http://vividcortex.github.io/angular-recaptcha/
MIT License
496 stars 257 forks source link

Cannot reload recaptcha #194

Closed Tarek-AbdelMaqsoud closed 7 years ago

Tarek-AbdelMaqsoud commented 7 years ago

Hello, When i try to reload the recaptcha, it gives me the following error

Invalid ReCAPTCHA client id:

here is my code: <script src="https://www.google.com/recaptcha/api.js?hl=ar&onload=vcRecaptchaApiLoaded&render=explicit" async defer></script>

<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-recaptcha/4.0.4/angular-recaptcha.js" async defer></script>

<div id="captcha_container" vc-recaptcha key="CaptchaKey" on-expire="CaptchaExpired()" on-success="setResponse(response)" on-create="onWidgetCreate(widgetId)"></div>

and here is my angular code `$scope.CaptchaExpired = function () { vcRecaptchaService.reload($scope.widgetId); };

    $scope.onWidgetCreate = function (_widgetId) {
        $scope.widgetId = _widgetId;
    };
    $scope.setResponse = function (response) {
        if (response !== null && response !== undefined && response !== '') {
            $scope.validCaptcha = true;
        }
    };`
TheSharpieOne commented 7 years ago

is CaptchaKey a placeholder in your example, or is that literally the code you have and use?

Tarek-AbdelMaqsoud commented 7 years ago

Actually it is just a placeholder ..

Tarek-AbdelMaqsoud commented 7 years ago

Well, seems it was an old bug, as i just solved it by upgrading to the latest version .. Thanks :)