judgelogin.js 1.6 KB


/**
 * 登录
 * @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";
		}
	});
	
}