JZC Auto Login

自动识别验证码登录

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

Advertisement:

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

Advertisement:

// ==UserScript==
// @name         JZC Auto Login
// @namespace    http://tampermonkey.net/
// @version      0.3
// @description  自动识别验证码登录
// @author       Sajor

// @match        http://127.0.0.1:3000/user/login*
// @match        http://localhost:3000/user/login*
// @match        http://jz-test.zimeitang.cn/user/login*
// @match        http://jz.zimeitang.cn/user/login*



// @require      https://cdn.bootcdn.net/ajax/libs/jquery/1.4.1/jquery.min.js
// @include      http://47.99.165.231:3000/user/login*
// @include      http://localhost:3000/user/login*
// @grant        none
// ==/UserScript==

(function() {

    function erp_auto(res, auto_code_url) {
        var base64 = res;
        $.ajax({
                url: auto_code_url,
                type: 'POST',
                contentType: 'application/json',
                data: JSON.stringify({
                    "base64": base64,
                    "name": "erp",
                    "threshold": 120,
                    "count": 0
                }), success:function(data) {
                    console.log(data);

                    $(":text")[1].value = data;
                    $(":text")[1].dispatchEvent(new Event('input'));
                    $(":submit").click();
                    // document.images[0].click();
                    //setTimeout(function() {
                    //    $("#submit").click();
                    //},0);
            }
        });
    }


    $(document).ready(function(){
        var auto_code_url = "http://auto.sajor.work/login_base";
        var img = document.images[0];

        // ERP
        $(".login-button").after("<button id='erp_auto' >auto login</button>")
        $("#erp_auto").click(function(){
            var res = document.images[0].currentSrc;
            erp_auto(res, auto_code_url);
            return false;
        });

    });
})();