|
1 | 1 | # RocketWeb Captcha Bypass |
2 | 2 | The extension disables Google reCAPTCHA by providing a simple hashed value thru a cookie |
3 | 3 |
|
4 | | -More details to come soon! |
| 4 | +## Installation |
| 5 | +Using composer: |
| 6 | +``` |
| 7 | +composer2 require rocketweb/magento-captcha-bypass |
| 8 | +``` |
| 9 | + |
| 10 | +## Setup |
| 11 | +Once installed, you need to configure the extension in |
| 12 | +**Stores -> Settings -> Configuration** then open **Security (tab) |
| 13 | +-> Google reCAPTCHA Storefront -> Bypass Storefront ReCaptcha** and set a unique |
| 14 | +random string for Secret Key field: |
| 15 | + |
| 16 | + |
| 17 | +## Usage |
| 18 | +When creating a Cypress Test, first you need to add ``CryptoJs`` library (or something similar that supports MD5): |
| 19 | +``` |
| 20 | +npm install crypto-js |
| 21 | +``` |
| 22 | +If all your packages are dev-dependencies, install this also as dependency: |
| 23 | +``` |
| 24 | +npm install crypto-js --save-dev |
| 25 | +``` |
| 26 | +Then include the crypto-js into at the top of the Cypress Test file: |
| 27 | +``` |
| 28 | +# ... (other import lines) ... |
| 29 | +import CryptoJS from 'crypto-js'; |
| 30 | +``` |
| 31 | +The final step is setting the Cookie needed to activate the Recaptcha Bypass |
| 32 | +inside the `it()` before any `cy.visit(...)` is called: |
| 33 | +``` |
| 34 | +it(['Can create an account', () => { |
| 35 | + let secretKey = '-Secret-Key-value-from-above-' |
| 36 | + let date = new Date(). getTime() |
| 37 | + let hash = CryptoJS.MD5(secretKey + '-' + date).toString(CryptoJS.enc.Hex) |
| 38 | + cy.setCookie('__rbp', hash); |
| 39 | +
|
| 40 | + cy.visit(...) |
| 41 | + ... |
| 42 | +}) |
| 43 | +``` |
| 44 | + |
| 45 | +This will add a cookie with specific hash that is than recognized by Magento code |
| 46 | +which disabled ReCaptcha on the page (if it's enabled that is). |
0 commit comments