|
楼主 |
发表于 2012-11-7 09:59:25
|
显示全部楼层
jishuang 发表于 2012-11-7 09:44
settings.changepassword.html 中怎么修改的?
<script type="text/javascript"
src="\UI\system\components\processChart\js\base.js"></script>
<script>
$.fn.extend({
passwordStrength:function() {
$(this).bind('keyup', function() {
var password = $(this).val();
var numericTest = /[0-9]/;
var lowerCaseAlphaTest = /[a-z]/;
var upperCaseAlphaTest = /[A-Z]/;
var symbolsTest = /[.,!@#$%^&*():|]/;
var score = 0;
var result =-1;
if (numericTest.test(password)) {
score++;
}
if (lowerCaseAlphaTest.test(password)) {
score++;
}
if (upperCaseAlphaTest.test(password)) {
score + 3;
}
if (symbolsTest.test(password)) {
score++;
}
if (password.length <= 0) {
result = -1;
} else if(score * password.length < 8){
result = 0;
} else if(score * password.length <= 16){
result = 1;
} else if(score * password.length > 16) {
result = 2;
}
$("#passwordStrength li").attr("class","");
for(var i=0;i <=result;i++){
$("#passwordStrength li").eq(i).addClass("on"+i);
if(i==result){
$("#passwordStrength li").eq(i).addClass("last");
}
}
});
}
});
function showPasswordHint(){
$(".hint").each(function(i){
if(($.trim($(this).text())).length>0){
$(this).show();
}else{
$(this).hide();
}
});
};
function checkOldPassword(){
if($.trim($("#oldPassword").val()).length<=0){
$("#oldPasswordHint").text("璇疯緭鍏ユ棫瀵嗙爜");
showPasswordHint();
return false;
}
$("#oldPasswordHint").text("");
showPasswordHint();
return true;
};
function checkNewPassword(){
var password = $("#newPassword").val();
var minSize = justep.Portal.passwordRule.minSize;
var maxSize = justep.Portal.passwordRule.maxSize;
var regs = justep.Portal.passwordRule.regs;
var showNewPasswordHint=function(hint){
if(hint&&hint.length>0){
$("#newPasswordHint").text(hint);
}else{
$("#newPasswordHint").text("");
}
showPasswordHint();
};
if(password.length <= 0){
showNewPasswordHint("璇峰~鍐欐柊瀵嗙爜");
return false;
}
if(minSize&&minSize.size&&password.length < minSize.size){
showNewPasswordHint(minSize.hint);
return false;
}
if(maxSize&&maxSize.size&&password.length > maxSize.size){
showNewPasswordHint(maxSize.hint);
return false;
}
if(regs){
for(var i=0;i < regs.length;i++){
if(regs.reg&&!regs.reg.test(password)){
showNewPasswordHint(regs.hint);
return false;
}
}
}
showNewPasswordHint();
return true;
};
function checkCheckPassword(){
if($.trim($("#checkPassword").val()).length<=0){
$("#checkPasswordHint").text("璇峰啀娆¤緭鍏ュ瘑鐮");
showPasswordHint();
return false;
}
if($("#checkPassword").val()!=$("#newPassword").val()){
$("#checkPasswordHint").text("涓ゆ瀵嗙爜杈撳叆涓嶄竴鑷");
showPasswordHint();
return false;
}
$("#checkPasswordHint").text("");
showPasswordHint();
return true;
};
var desc = justep.Portal.passwordRule.desc;
$("#descChangePasswordRule").html(desc&&desc.length>0?desc:$("#descChangePasswordRule").hide());
$("#newPassword").passwordStrength();
$("#newPassword").bind("blur",function(){
setTimeout("checkNewPassword()",200);
});
$("#oldPassword").bind("blur",function(){
setTimeout("checkOldPassword()",200);
});
$("#checkPassword").bind("blur",function(){
checkCheckPassword();
});
$("#submitBtn").click(function(){
var check = checkOldPassword()&checkNewPassword()&checkCheckPassword();
if(check){
var username = "";
var oldPassword = $("#oldPassword").val();
var newPassword = $("#newPassword").val();
var param = new justep.Request.ActionParam();
param.setString("pwd", newPassword);
var result = justep.Request.sendBizRequest(
"/RTX/RTXtest/process/loginrtx/loginrtxProcess",
"mainActivity", "changepwd", param);
alert("鍙栧緱鐨剆ession鏄:"
+ justep.Request.getData(result.responseXML).text);
oldPassword = hex_md5(oldPassword);
newPassword = hex_md5(newPassword);
$.jpolite.Data.system.User.changePassword(username, oldPassword,newPassword, function
(data){
if (data) {
if (data.status) {
$("input:password").val("").keyup();
//$("#oldPassword").focus();
}
$("#resultChangePassword").text(data.message || "");
showPasswordHint();
}
});
}else{
$("#resultChangePassword").text("淇敼鏈畬鎴愯瀹屾垚鍚庡啀鎻愪氦");
showPasswordHint();
}
});
</script>
红色部分就是修改的代码 |
|