A
Alokai13mo ago
Caroline

Remove google recaptcha from login modal

Only remove google recaptcha from login modal
9 Replies
skirianov
skirianov13mo ago
Hey, can you give more info on the project you're using. It's not clear what exactly you need
Caroline
CarolineOP13mo ago
@skirianov I have enabled Google Recaptcha in the. env configuration of VSF, but I want to not do Google verification in the login module. I found that Google verification is done in/node_ Modules/@vue-storefront/magento-api/server/index.js, and this js has been compressed, I don't know how to remove it
Caroline
CarolineOP13mo ago
No description
Darren R
Darren R13mo ago
@Caroline You could try overriding the global config setting that LoginModal.vue is using.
const isRecaptchaEnabled = ref<boolean>(typeof $recaptcha !== 'undefined' && Boolean($config.isRecaptcha));
const isRecaptchaEnabled = ref<boolean>(typeof $recaptcha !== 'undefined' && Boolean($config.isRecaptcha));
The above is using your value from env, just set it to false and then it shouldn't be used for the Login.
const isRecaptchaEnabled = ref(false)
const isRecaptchaEnabled = ref(false)
Caroline
CarolineOP13mo ago
@Darren R I have tried this method, but it will not display the Google recaptcha verification box on loginModal, but the interface will still request Google verification because const {secretkey}=context. config. recaptcha; Obtaining the configuration status in. env
Darren R
Darren R13mo ago
You're right. I just looked in node_modules/@vue-storefront/magento-api/lib/index.server.js and it's checking config.recaptcha.isEnabled directly there. It looks like setting it to true in env will enable for all the supported queries and you cannot turn off for just one (generateCustomerToken) as it's in the middleware.
Caroline
CarolineOP13mo ago
@Darren R Yes, node Modules/@ vue storefront/magento api/lib/index. server.js is vsf version 1.2.0, and /node Modules/@ vue storefront/magento api/server/index.js is version 1.3.1.
Maybe I need to rewrite /node_ Modules/@ vue storefront/magento api/server/index.js, but I dont't know how to do it. Do you have a good solution?
Darren R
Darren R13mo ago
@Caroline I'm not sure you can overwrite just that one function and overwriting the full file wouldn't be ideal. We turned off the recaptcha in our env and then used HTTP headers on the queries we wanted protecting: https://developer.adobe.com/commerce/webapi/graphql/usage/protected-mutations/
Protected mutations
Learn how to use CAPTCHA and reCAPTCHA to protect GraphQL mutations.
Caroline
CarolineOP13mo ago
@Darren R Thanks, I'll try this method;
Want results from more Discord servers?
Add your server