You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
DS7/DSWeb/js/changepassword.js

111 lines
2.6 KiB
JavaScript

function $(id){
return document.getElementById(id);
}
function postEnterFee(){
var myForm = document.getElementById("form1");
myForm.submit() ;
}
function saveAction(){
var isPass = validUserInput();
if(isPass){
$("h_post").value = "1";
postEnterFee();
}
}
function validUserInput(){
var origword = $("txt_origpwd").value;
gbcode = /^[\u4e00-\u9fa5]+$/i;
if(origword.trim() != ""){
chkFlag = gbcode.test(origword);
if(chkFlag){
alert("原始密码 格式错误,请修改-不支持中文");
return false;
}
if(origword.trim().length < 3){
alert("原始密码 长度不能小于3");
return false;
}
}else{
alert("原始密码 不能为空");
return false;
}
var newWord = $("txt_newpwd").value;
if(newWord.trim() != ""){
chkFlag = gbcode.test(newWord);
if(chkFlag){
alert("新密码 格式错误,请修改-不支持中文");
return false;
}
if(newWord.trim().length < 3){
alert("新密码 长度不能小于3");
return false;
}
}else{
alert("新密码 不能为空");
return false;
}
var confirmWord = $("txt_comfirm").value;
if(confirmWord.trim() != ""){
chkFlag = gbcode.test(confirmWord);
if(chkFlag){
alert("重复密码 格式错误,请修改-不支持中文");
return false;
}
if(confirmWord.trim().length < 3){
alert("重复密码 长度不能小于3");
return false;
}
}else{
alert("重复密码 不能为空");
return false;
}
var baseInfo = null;
var url = "AccountService.aspx?handle=validatepwd&pwd="+origword+"&uid="+newGuid();
var loader = dhtmlxAjax.getSync(url);
var baseInfoVal = loader.xmlDoc.responseText;//alert(opInfo);
if(baseInfoVal <= 0){
alert("原始密码输入错误");
return false;
}
if(newWord.trim() != confirmWord.trim()){
alert("新密码与重复密码不一致,请重新输入");
return false;
}
return true;
}
String.prototype.trim = function() { return this.replace(/(^\s*)|(\s*$)/g,""); }
//获取GUID
function newGuid()
{
var guid = "";
for (var i = 1; i <= 32; i++){
var n = Math.floor(Math.random()*16.0).toString(16);
guid += n;
if((i==8)||(i==12)||(i==16)||(i==20))
guid += "-";
}
return guid.toUpperCase();
}