| Server IP : 119.36.225.67 / Your IP : 43.159.78.114 Web Server : nginx/1.28.0 System : Linux 1763701629066 6.8.0-53-generic #55-Ubuntu SMP PREEMPT_DYNAMIC Fri Jan 17 15:37:52 UTC 2025 x86_64 User : www ( 1001) PHP Version : 8.2.28 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /www/wwwroot/www.lengcat.cn/wp-content/themes/onenav/assets/js/ |
Upload File : |
/*
* @Author: iowen
* @Author URI: https://www.iowen.cn/
* @Date: 2022-02-10 22:22:47
* @LastEditors: iowen
* @LastEditTime: 2024-10-04 03:02:29
* @FilePath: /onenav/assets/js/captcha.js
* @Description: 验证
*/
function CaptchaInit() {
var _mode = $('[captcha-type]');
if (_mode.length) {
var mode = _mode.attr('captcha-type');
var _body = $('body');
window.captcha = {}
switch (mode) {
case 'image':
var _code = $('.image-captcha');
_code.each(function () {
get_img($(this));
});
$('.image-captcha').click(function () {
get_img($(this));
});
function get_img(_this) {
$.ajax({
url: IO.ajaxurl,
data: {
action: 'get_img_captcha',
id: _this.data('id'),
},
}).done(function (data) {
_this.html('<img alt="img code" src="' + data.img + '" class="">');
});
}
break;
case 'slider':
ioRequire('slidercaptcha');
break;
case 'tcaptcha':
var $btn = $("#TencentCaptcha.io-tcaptcha");
var appid = _mode.data('appid');
if (!$btn.length) {
_body.append('<div class="hide io-tcaptcha" id="TencentCaptcha" data-appid="' + appid + '" data-cbfn="TCaptchaOK"></div>');
if (_mode.data('isfree')) {//免费版
$.getScript("//ssl.captcha.qq.com/TCaptcha.js");
} else {
$.getScript("//turing.captcha.qcloud.com/TCaptcha.js");
}
}
break;
case 'geetest':
GeetestOpen(false);
break;
case 'vaptcha':
VaptchaOpen(false);
break;
}
}
}
CaptchaInit();
function CaptchaOpen(_this, mode) {
switch (mode) {
case 'slider':
SliderCaptchaOpen(_this);
break;
case 'tcaptcha':
TCaptchaOpen(_this);
break;
case 'geetest':
window.captcha._this = _this;
GeetestOpen(true);
break;
case 'vaptcha':
window.captcha._this = _this;
VaptchaOpen(true);
break;
}
return !1;
}
//腾讯验证码
function TCaptchaOpen(_this) {
console.log(25);
window.captcha._this = _this;
$("#TencentCaptcha.io-tcaptcha").trigger('click');
}
function TCaptchaOK(res) {
window.captcha.ticket = 0;
window.captcha.randstr = 0;
if (res.ret === 0) {
window.captcha.ticket = res.ticket;
window.captcha.randstr = res.randstr;
window.captcha._this.click();
}
}
//极验行为验4.0
function GeetestOpen(open) {
var _mode = $('[captcha-type]');
if (window.GeetestCaptcha) {
open && window.GeetestCaptcha.showCaptcha();
return;
}
if (!_mode.length) {
return;
}
initGeetest4({
captchaId: _mode.data('appid'),
product: 'bind',
}, function (captchaObj) {
captchaObj.onReady(function () {
window.GeetestCaptcha = captchaObj;
open && captchaObj.showCaptcha();
}).onSuccess(function (e) {
var getValidate = captchaObj.getValidate();
window.captcha.captcha_output = getValidate.captcha_output;
window.captcha.gen_time = getValidate.gen_time;
window.captcha.lot_number = getValidate.lot_number;
window.captcha.ticket = getValidate.pass_token;
window.captcha._this.click();
})
});
}
//Vaptcha
function VaptchaOpen(open) {
var _mode = $('[captcha-type]');
if (window.VaptchaObj) {
open && window.VaptchaObj.validate();
return;
}
if (!_mode.length) {
return;
}
vaptcha({
vid: _mode.data('appid'),
mode: 'invisible',
scene: 0,
area: 'auto',
}).then(function (VAPTCHAObj) {
window.VaptchaObj = VAPTCHAObj;
VAPTCHAObj.listen('pass', function () {
serverToken = VAPTCHAObj.getServerToken();
window.captcha.ticket = serverToken.token;
window.captcha.server = serverToken.server;
window.VaptchaObj.reset();
window.captcha._this.click();
})
})
}