google recaptcha

google recaptcha

Andreas S.Andreas S. Posts: 169Questions: 58Answers: 4
edited July 2019 in Editor

I have a provlem with the google reCaptcha v2. I have implementet it in a single Editor with this code:

    $( '#usr-signin' ).on( 'click', function() {
            .title( '<i class="fad fa-sign-in-alt txt-DarkCyan"></i> <span class="txt-DarkCyan bold">' + frmInfo.s_title + '</span>' )
            .buttons( [
                { label: frmInfo.login, action: function() { this.submit(
                    function() {
                        //window.location.href = 'index.php';
                    function( data ) {
                        _PNotify( 'error', data['error']['errCode'] + ' ' + data['error']['errShort'], data['error']['icon'], data['error']['info'] );
                } ); }, className: 'btn-DarkCyan' },
                { label: frmInfo.cancel, action: function() { this.close(); } },
                { label: 'reset password', action: function() {

                } }
            ] ).edit();
        $( 'div.modal-dialog' ).removeClass( 'registration-dialog' ).addClass( 'login-dialog' );
        $( 'div.modal-content' ).removeClass( 'registration-content' ).addClass( 'login-content' );
        $( '<div class="g-recaptcha ml-100" data-sitekey="6LeD6g8Ucxxxxxxxxxxxxeded">' +
             '</div><script src=""></script>' ).insertAfter( 'div.DTE_Field_Type_password' );
    } );

The captcha of google works, but if the submit button is pressed, the data will be sent no matter if captcha is true or not. How can I be sent before data check if the recaptcha is ok or not. Is there a simpler method? the security side does not help me here.


This question has an accepted answers - jump to answer


  • colincolin Posts: 9,077Questions: 0Answers: 1,520
    Answer ✓

    Hi @Andreas S. ,

    I don't anything about the reCaptcha, but I'm guessing there's a method that confirms whether it's been validated or not. You could call that in initSubmit, run that validation test, and if it fails cancel the submit by returning false,



Sign In or Register to comment.