IT运维管理平台
IT
Management Center
{##}
{##}
{#
{# style="color: #FFFFFF !important; position:absolute; z-index:100;width: 100px"value=""#}
{# type="text"placeholder="请输入验证码">#}
{#
{# style="position: absolute;top:1px;right: 0;margin-right: -125px">#}
{##}
正在为您火速加载中....
登录
functionchangeImg(ths) {
ths.src=ths.src+ "?";
}
{# $('#mybtn').click(function() {#}
{# $('#username').next().remove();#}
{# $('#password').next().remove();#}
{# $('#code').siblings('.error_div1').remove();#}
{# $('#username').parent().parent().find(".error_div2").remove();#}
{#varflag= true;#}
{#varuser_name=$('#username').val();#}
{#varuser_pwd=$('#password').val();#}
{#varcheck_code=$('#code').val();#}
{#if(flag) {#}
{# $.ajaxSetup({#}
{# data: {csrfmiddlewaretoken:'{{ csrf_token }}'}#}
{# });#}
{# $.ajax({#}
{# url:'/login/',#}
{# type:'POST',#}
{# data: {"username": user_name,"password": user_pwd,"code": check_code},#}
{# dataType:"JSON",#}
{# success:function(data) {#}
{#if(data.status) {#}
{# location.href= '/login_first/'#}
{# }#}
{#else#}
{# {#}
{# console.log(data);#}
{# $.each(data.error,function(k, v) {#}
{#if(k== 'username') {#}
{#var$msg= "
{# $('#' +k).after($msg)#}
{# }else if(k== 'password') {#}
{#var$msg= "
{# $('#' +k).after($msg)#}
{# }else if(k== 'code') {#}
{#var$msg= "
{# $('#' +k).after($msg)#}
{# }#}
{#else{#}
{#var$msg= "
{# $('#username').parent().before($msg);#}
{# }#}
{##}
{# });#}
{# }#}
{# }#}
{# })#}
{# }#}
{##}
{# });#}varhandlerPopup= function(captchaObj) {
captchaObj.onReady(function() {//1.极验加载/准备时回调函数
$("#loading-tip").hide();
$('#login_zone').show();
});
captchaObj.onSuccess(function() {//2.极验加载成功的回调
$('#login_zone').hide();varvalidate=captchaObj.getValidate();
$.ajax({//3.发送用户输入到后台
url:"{% url 'login'%}",
type:"post",
dataType:"json",
data: {
username: $('#username').val(),
password: $('#password').val(),
csrfmiddlewaretoken:'{{ csrf_token }}',
geetest_challenge: validate.geetest_challenge,
geetest_validate: validate.geetest_validate,
geetest_seccode: validate.geetest_seccode
},
success:function(data) {if(data.status) {//4.后端验证成功跳转
location.href= '/login_first/'}else{
$('#login_zone').show();
captchaObj.reset();//4.后端验证失败,从新加载极致验证插件;
$('#popup-captcha').hide();
$('#username').next().remove();
$('#password').next().remove();
$('#code').siblings('.error_div1').remove();
$('#username').parent().parent().find(".error_div2").remove();
$.each(data.error,function(k, v) {if(k== 'username') {var$msg= "
$('#' +k).after($msg)
}else if(k== 'password') {var$msg= "
$('#' +k).after($msg)
}else if(k== 'code') {var$msg= "
$('#' +k).after($msg)
}else{var$msg= "
$('#username').parent().before($msg);
}
});
}
}
});
});
$("#mybtn").click(function() {
captchaObj.appendTo("#popup-captcha");
$('#popup-captcha').show()
});
};
$.ajax({//0.加载极验插件
url:"/pc-geetest/register?t=" +(newDate()).getTime(),//加随机数防止缓存
type:"get",
dataType:"json",
success:function(data) {//使用initGeetest接口
//参数1:配置参数
//参数2:回调,回调的第一个参数验证码对象,之后可以使用它做appendTo之类的事件
initGeetest({
gt: data.gt,
challenge: data.challenge,
product:"popup",//产品形式,包括:float,embed,popup。注意只对PC版验证码有效
offline:!data.success//表示用户后台检测极验服务器是否宕机,一般不需要关注
//更多配置参数请参见:http://www.geetest.com/install/sections/idx-client-sdk.html#config
}, handlerPopup);
}
});