• 免费在线行为验证,保护你的账号安全


    前言

    忘记繁琐的验证码吧!免费在线行为验证服务,通过滑动图片、滑动拼图和文字点选等方式,确保只有真正的人类用户能够访问。

    在这里插入图片描述

    前端代码

    <script src="https://cdn6.kgcaptcha.com/captcha.js">script>
    <script>
    kg.captcha({
        // 绑定元素,验证框显示区域
        bind: "#captchaBox",
        // 验证成功事务处理
        success: function(e) {
            console.log(e);
        },
        // 验证失败事务处理
        failure: function(e) {
            console.log(e);
        },
        // 点击刷新按钮时触发
        refresh: function(e) {
            console.log(e);
        }
    });
    script>
    <div id="captchaBox">载入中 ...div>
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20

    Python代码

    from wsgiref.simple_server import make_server
    from KgCaptchaSDK import KgCaptcha
    def start(environ, response):
        # 填写你的 AppId,在应用管理中获取
        AppID = "AppID"
        # 填写你的 AppSecret,在应用管理中获取
        AppSecret = "AppSecret"
        request = KgCaptcha(AppID, AppSecret)
        # 填写应用服务域名,在应用管理中获取
        request.appCdn = "https://cdn6.kgcaptcha.com"
        # 请求超时时间,秒
        request.connectTimeout = 10
        # 用户id/登录名/手机号等信息,当安全策略中的防控等级为3时必须填写
        request.userId = "kgCaptchaDemo"
        # 使用其它 WEB 框架时请删除 request.parse,使用框架提供的方法获取以下相关参数
        parseEnviron = request.parse(environ)
        # 前端验证成功后颁发的 token,有效期为两分钟
        request.token = parseEnviron["post"].get("kgCaptchaToken", "")  # 前端 _POST["kgCaptchaToken"]
        # 客户端IP地址
        request.clientIp = parseEnviron["ip"]
        # 客户端浏览器信息
        request.clientBrowser = parseEnviron["browser"]
        # 来路域名
        request.domain = parseEnviron["domain"]
        # 发送请求
        requestResult = request.sendRequest()
        if requestResult.code == 0:
            # 验证通过逻辑处理
            html = "验证通过"
        else:
            # 验证失败逻辑处理
            html = f"{requestResult.msg} - {requestResult.code}"
        response("200 OK", [("Content-type", "text/html; charset=utf-8")])
        return [bytes(str(html), encoding="utf-8")]
    httpd = make_server("0.0.0.0", 8088, start)  # 设置调试端口  http://localhost:8088/
    httpd.serve_forever()
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36

    最后

    安全登录从行为验证开始,快速验证人类身份,提升账号安全,行为验证只需几秒钟!
    SDK开源地址:https://github.com/KgCaptcha,顺便做了一个演示:https://www.kgcaptcha.com/demo/

  • 相关阅读:
    【Linux】谈谈shell外壳是什么?
    Blazor OIDC 单点登录授权实例5 - 独立SSR App (net8 webapp ) 端授权
    【愚公系列】2022年11月 uniapp专题-环境配置
    java 批量更改
    将PaddleOCR 转为 ONNX 运行
    windows下安装Mongodb
    EIP-3664合约研究笔记05--扩展属性分析
    【7月12日活动预告】现代数据栈峰会
    JWT有关知识
    Nginx三大常用功能“反向代理,负载均衡,动静分离”
  • 原文地址:https://blog.csdn.net/weixin_40794177/article/details/132606183