New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

vue3-smart-captcha

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue3-smart-captcha

Yandex Smart Captcha for Vue3 projects

  • 0.2.0
  • npm
  • Socket score

Version published
Weekly downloads
114
decreased by-29.63%
Maintainers
1
Weekly downloads
 
Created
Source

Yandex SmartCaptcha for Vue3 projects

Adds Yandex SmartCaptcha component into your Vue3 application

You need to create Captcha and get keys. You need client site key in order to activate captcha component and it is the only required property

NOTE: this package does NOT provides verification of response - you still need to implement it

Installation

Install it using npm

npm install vue3-smart-captcha

# Or using pnpm
pnpm add vue3-smart-captcha

Usage

No need to add widget script in the head section of your site

As plugin

// main.js
import { createApp } from 'vue'
import { SmartCaptchaPlugin } from 'vue3-smart-captcha'

const app = createApp({})

app.use(SmartCaptchaPlugin)

As component

<template>
    <SmartCaptcha :sitekey="sitekey" />
</template>

<script setup>
import { SmartCaptcha } from 'vue3-smart-captcha'

const sitekey = 'client_site_key' // import.meta.env.VITE_YANDEX_SMART_CAPTCHA_KEY
</script>

You may add style="height: 100px" in order to prevent layout jump

<template>
    <SmartCaptcha style="height: 100px" :sitekey="sitekey" />
</template>

Options

Only sitekey is required

PropertyDefaultType
sitekey-string
loadWidgettrueboolean
callbackundefined(token: string) => void
hlwindow.navigator.language'ru', 'en', 'be', 'kk', 'tt', 'uk', 'uz', 'tr'
testfalseboolean
webviewfalseboolean
invisiblefalseboolean
shieldPositioncenter-right'top-left', 'center-left', 'bottom-left', 'top-right', 'center-right', 'bottom-right'
hideShieldfalseboolean
on-successundefined(token: string) => void
on-network-errorundefined() => void
on-challenge-visibleundefined() => void
on-challenge-hiddenundefined() => void
on-token-expiredundefined() => void

Basically it gets every parameter of window.smartCaptcha object plus 5 callbacks for every subscription events named as on + event name in camelCase ('success' => 'onSuccess', 'network-error' => 'onNetworkError', etc)

Do not load widget

You may add script tag <script src="https://smartcaptcha.yandexcloud.net/captcha.js?render=onload" defer></script> yourself or using Nuxt config. This way you don't need to render widget script itself. Just set :load-widget="false" to disable script loading

License

Open-source under MIT license

Testing

We are using Vitest

Help wanted to cover properties were passed to window.smartCaptcha object

pnpm test

Keywords

FAQs

Package last updated on 09 Nov 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc