Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hiding captcha when navigating with useRouter #1476

Open
Aspyryan opened this issue Dec 26, 2023 · 5 comments
Open

Hiding captcha when navigating with useRouter #1476

Aspyryan opened this issue Dec 26, 2023 · 5 comments
Labels

Comments

@Aspyryan
Copy link

Description

Captcha v3 popup not disappearing when navigation from page to page.

When I navigate using the router.push. The popup is still visible but not needed anymore. Can I somehow destroy the captcha?

image

Minimal Reproducible Example

https://stackblitz.com/edit/vue-rrrchm?file=src%2Fviews%2FLoginView.vue

System info

System:
OS: Windows 11 10.0.22631
CPU: (12) x64 AMD Ryzen 5 7600X 6-Core Processor
Memory: 15.25 GB / 31.15 GB
Binaries:
Node: 16.16.0 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.17 - ~\AppData\Roaming\npm\yarn.CMD
npm: 8.11.0 - C:\Program Files\nodejs\npm.CMD
Browsers:
Edge: Chromium (120.0.2210.91)
Internet Explorer: 11.0.22621.1
npmPackages:
@vitejs/plugin-vue: ^4.5.2 => 4.5.2
vite: ^5.0.10 => 5.0.10
vue-recaptcha: ^3.0.0-alpha.2 => 3.0.0-alpha.2

@Aspyryan Aspyryan added the bug label Dec 26, 2023
@ricardo17coelho
Copy link

I'm also facing this issue.
@Aspyryan did u find some workaround fo this ?

@DanSnow is possible to hide/show the badge ?
Something like, when unmounted -> hide(), then mounted -> show()

@ricardo17coelho
Copy link

@DanSnow can u pls answer ?

@DanSnow
Copy link
Owner

DanSnow commented Jan 22, 2024

@ricardo17coelho
Copy link

@DanSnow if i set the style globally, it will hide the captcha everywhere..
I need to hide it depeding on the current route 🧐

@ricardo17coelho
Copy link

Ok.. i found an workaround.. but i think that u @DanSnow should add an switch show() / hide() to the composable.

Add global stlye:

.grecaptcha-badge {
  visibility: hidden !important;
}

.grecaptcha-badge-show {
  visibility: visible !important;
}

i have an component where i use everywhere i need the Captcha & there i have:

onMounted(() => {
  const grecaptchaBadgeEl = document.querySelector('.grecaptcha-badge');
  if (grecaptchaBadgeEl) {
    grecaptchaBadgeEl.classList.add('grecaptcha-badge-show');
  }
});

onUnmounted(() => {
  const grecaptchaBadgeEl = document.querySelector('.grecaptcha-badge');
  if (grecaptchaBadgeEl) {
    grecaptchaBadgeEl.classList.remove('grecaptcha-badge-show');
  }
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants