judgelogin.js
1.6 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/**
* 登录
* @returns {Boolean}
*/
function loginpwd(){
var username = $('#username').val();
var password = $('#password').val();
var vCode = $('#vCode').val();
if(username.length < 1) {
$('#tc_vcode_img')[0].src=basePath+'/authImage?x='+Math.random();
$('.error').html('请输入帐号!');
return false;
}
if(password.length < 1) {
$('#tc_vcode_img')[0].src=basePath+'/authImage?x='+Math.random();
$('.error').html('请输入密码!');
return false;
}
$.post(basePath+"/doJudgeLogin",{loginAccount:username,password:password,vCode:vCode},function(result){
if(result.status == 200){
window.location.href=basePath+"/judge/index";
}else if(result.status == 405){
window.location.href=basePath+"/forceChangeJudgePassword?uid="+result.data;
}else{
$('.error').html(result.msg);
$('#tc_vcode_img')[0].src=basePath+'/authImage?x='+Math.random();
}
});
}
function doForceChangePassword(){
var uid = $('#uid').val();
var type = $('#type').val();
var password = $('#password').val();
var password2 = $('#password2').val();
var par = {};
par.uid=uid;
par.password=password;
par.password2 = password2;
par.type = type;
$('.errMsg').html("");
$.post(basePath+"/doForceChangeJudgePassword",par,function(result){
if(result.status == 2){
window.location.href=basePath+"/judge/index";
}else if(result.status == 0){
for(i in result.data){
$('.errMsg_'+i).html(result.data[i]);
}
}else{
alert("修改成功");
window.location.href=basePath+"/judge/index";
}
});
}