Add Google recaptcha





  • i also want to add Google recaptchabut facing some issues in API call, try this method.

    Darik elwan



  • I created a GitHub issue requesting a better management of the reCaptcha.
    https://github.com/uvdesk/community-skeleton/issues/368



  • @peopleinside

    We also want to provide recaptcha but the problem is a key need to generate for your site from https://www.google.com/recaptcha/ here to use recaptcha into your site and which is unique code for the site as project is opensource(no fix domain or site) so person need to set it up for themselves.

    But still we will check if we just write code for that and once you enter your recaptcha code for your site then it will enable for you !!



  • @Sanjeev I use other application different from uvdesk, for example a live chat system.
    I know is possibile add an option in the admin side where user can activate reCaptcha.

    SharedScreenshot.jpg

    For example in live helper chat you have a setting where you can set the secret code for reCaptcha than activate.
    If reCaptcha is active is showed on login page, if not is not active and not showed.

    The same should be possible also in Uvdesk.



  • @peopleinside

    Is live chat self hosted ?





  • @peopleinside

    Fine, We will check the possibility with our system and will try to add this.



  • @Sanjeev will be very useful. Thanks.
    I updated my previous reply with more link. You have also live helper chat demo online to see how it looks on admin side.



  • This thread is very interesting and gives a good knowledge , i will try to add google recaptcha by this method ~ Ali Sami Farooq



  • @peopleinside

    Please generate Recaptcha keys (site key and secret key) for your domain if you need Recaptcha for your site we have updated the code for the same but need to test it for a live domain.

    When you will be available reply back to us will will process further.



  • @Sanjeev I'm ready and I'm already use the recaptcha but only on ticket creation. You can find me on Skype if you need or let me know how can I help you.



  • @peopleinside

    Have you generated site key and secret key for your domain for google recaptcha?



  • @Sanjeev Sure



  • @peopleinside

    Ok please take a backup of your current project and apply the changes for a new one.

    For generating recaptcha site key and secret key for your domain take help from here.

    Step 1.

    Delete your core-framework and support-center-bundle under vendor/uvdesk folder of your project.

    And clone both bundle using command below at the same place (under vendor/uvdesk folder)

    git clone https://github.com/uvdesk/core-framework
    git clone https://github.com/uvdesk/support-center-bundle



  • Step 2.

    Open config/packages folder of your project.
    You will see two files here twig.yaml and uvdesk.yaml

    Update below 3 keys in twig.yaml

     is_google_captcha_enabled: '%is_google_captcha_enabled%'
     recaptcha_site_key: '%recaptcha_site_key%'
     recaptcha_secret_key: '%recaptcha_secret_key%'
    
    
    

    In uvdesk.yaml update below lines:

    recapchaUvdesk.PNG

        is_google_captcha_enabled: true
        recaptcha_site_key: 'site_key'
        recaptcha_secret_key: 'secret_key'
    

    Finally clear your cache using below command:

    php bin/console c:c



  • Step 3.

    Require recaptcha package in your project using below command:

    composer require google/recaptcha "^1.2"

    Also update your site key and secret key of google recaptcha for your domain in uvdesk.yaml file.

    Clear your cache:
    php bin/console c:c



  • @Sanjeev

    The "ocramius/package-versions" plugin was skipped because it requires a Plugin API version ("^1.0.0") that does not match your Composer installation ("2.0.0"). You may need to run composer update with the "--no-plugins" option.
    The "uvdesk/composer-plugin" plugin was skipped because it requires a Plugin API version ("^1.0") that does not match your Composer installation ("2.0.0"). You may need to run composer update with the "--no-plugins" option.
    The "symfony/flex" plugin was skipped because it requires a Plugin API version ("^1.0") that does not match your Composer installation ("2.0.0"). You may need to run composer update with the "--no-plugins" option.
    ./composer.json has been updated
    The "ocramius/package-versions" plugin was skipped because it requires a Plugin API version ("^1.0.0") that does not match your Composer installation ("2.0.0"). You may need to run composer update with the "--no-plugins" option.
    The "uvdesk/composer-plugin" plugin was skipped because it requires a Plugin API version ("^1.0") that does not match your Composer installation ("2.0.0"). You may need to run composer update with the "--no-plugins" option.
    The "symfony/flex" plugin was skipped because it requires a Plugin API version ("^1.0") that does not match your Composer installation ("2.0.0"). You may need to run composer update with the "--no-plugins" option.
    
    Your requirements could not be resolved to an installable set of packages.
    
      Problem 1
        - symfony/flex is locked to version v1.4.8 and an update of this package was not requested.
        - symfony/flex v1.4.8 requires composer-plugin-api ^1.0 -> found composer-plugin-api[2.0.0] but it does not match the constraint.
      Problem 2
        - uvdesk/composer-plugin is locked to version v1.0.1 and an update of this package was not requested.
        - uvdesk/composer-plugin v1.0.1 requires composer-plugin-api ^1.0 -> found composer-plugin-api[2.0.0] but it does not match the constraint.
      Problem 3
        - ocramius/package-versions 1.4.1 requires composer-plugin-api ^1.0.0 -> found composer-plugin-api[2.0.0] but it does not match the constraint.
        - doctrine/doctrine-migrations-bundle 2.1.2 requires doctrine/migrations ^2.2 -> satisfiable by doctrine/migrations[2.2.0].
        - doctrine/migrations 2.2.0 requires ocramius/package-versions ^1.3 -> satisfiable by ocramius/package-versions[1.4.1].
        - doctrine/doctrine-migrations-bundle is locked to version 2.1.2 and an update of this package was not requested.
    
    ocramius/package-versions only provides support for Composer 2 in 1.8+, which requires PHP 7.4.
    If you can not upgrade PHP you can require composer/package-versions-deprecated to resolve this with PHP 7.0+.
    
    You are using Composer 2, which some of your plugins seem to be incompatible with. Make sure you update your plugins or report a plugin-issue to ask them to support Composer 2.
    

    I'm now resuming my backup as it not works.
    The ReCaptcha is showed in the contact form but never work.



  • @peopleinside

    Please downgrade your composer version to 1.6.5 and then try.

    Also take a clone of core-framework again as recently we have updated some code there.

    We have tested recaptcha and it is working perfectly now.



  • I have also an issue: cannot run

    php bin/console c:c
    

    because every time I get

    Unable to write in the "/uvdesk/var/cache/prod"
     directory
    

    and I need run this command as root. I change already all uvdesk folders and file to be on not root user and for a while I'm able to run but after some time I get again the same issue.


Log in to reply