Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

geetest-captcha

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

geetest-captcha

package for geetest web

latest
npmnpm
Version
1.1.2
Version published
Maintainers
1
Created
Source

get start

import Captcha from '@bilibili/geetest-captcha'

const getGeetestConfigApi = () => new Promise(resolve => {
  resolve({
    gt,
    challenge,
    success,
    // others...
  })
})

// 在 entry-client.js 绑定到 Vue 下或者在 methods 里 new 一个来使用
Vue.prototype.$captcha = new Captcha(getGeetestConfigApi)

this.$captcha(({ data, captcha }) => {
    // do something on success
    // data = {
    //   geetest_challenge: result.geetest_challenge,
    //   geetest_seccode: result.geetest_seccode,
    //   geetest_validate: result.geetest_validate,
    //   others_get_geetest_api_result
    // }
    // captcha = geetest instance
})

this.$captcha({
    config: {
      // docs:https://docs.geetest.com/install/deploy/client/web#%E9%85%8D%E7%BD%AE%E5%8F%82%E6%95%B0
    },
    el: document.getElementById('xxx'), // not required, use at captcha.appendTo
    async: true, // not required, use at product = bind, click verify or api resolve verify
    ready: (() => {
        // do something
    }),
    success: ({ data, captcha }) => {
        // do something
    },
    error: (err => {
        // do something
        // err = {
        //   code: -1,        // -1:window.initGeetest is not defined, -2:geetest onError
        //   status_code: -1,
        //   message: 'xxx'
        // }
    }),
    close: (() => {
        // do something
    })
})

Keywords

geetest

FAQs

Package last updated on 18 Nov 2019

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