|
|
@@ -0,0 +1,67 @@ |
|
|
|
(function () { |
|
|
|
var userinfo = null; |
|
|
|
var page = { |
|
|
|
isScroll: true, |
|
|
|
init: function ($page) { |
|
|
|
userinfo = learun.storage.get('userinfo'); |
|
|
|
//主被动修改密码判断 |
|
|
|
if (learun.storage.get('pwd')===true) { |
|
|
|
$page.find('#strongpwd').css("display", "block"); |
|
|
|
$page.find('#strongpwdout').css("display", "block"); |
|
|
|
} |
|
|
|
$page.find('#savepassword').on('tap', function () { |
|
|
|
if (!$('#modifypasswordform').lrformValid()) { |
|
|
|
return false; |
|
|
|
} |
|
|
|
var formdata = $('#modifypasswordform').lrformGet(); |
|
|
|
var reg = /^(?=.*[0-9])(?=.*[A-Z])(?=.*[a-z])(?=.*[!@#$%^&*,\.])[0-9a-zA-Z!@#$%^&*,\.]{8,20}$/; |
|
|
|
if (!reg.test(formdata.newpassword)) { |
|
|
|
learun.layer.toast('密码不满足强度要求'); |
|
|
|
return false; |
|
|
|
} |
|
|
|
if (formdata.newpassword1 === formdata.newpassword) { |
|
|
|
|
|
|
|
var req = { |
|
|
|
newpassword: $.md5(formdata.newpassword), |
|
|
|
oldpassword: $.md5(formdata.oldpassword) |
|
|
|
}; |
|
|
|
learun.layer.loading(true); |
|
|
|
// 访问后台修改密码 |
|
|
|
learun.httppost(config.webapi + "learun/adms/user/modifypw", req, (data,info) => { |
|
|
|
learun.layer.loading(false); |
|
|
|
if (data) {// 表单数据保存成功,发起流程 |
|
|
|
learun.layer.toast(info); |
|
|
|
learun.storage.set('logininfo', null); |
|
|
|
learun.storage.set('pwd', false); |
|
|
|
learun.nav.go({ path: 'login', isBack: false, isHead: false }); |
|
|
|
} |
|
|
|
return false; |
|
|
|
}); |
|
|
|
} |
|
|
|
else { |
|
|
|
learun.layer.toast('二次输入密码不同'); |
|
|
|
} |
|
|
|
}); |
|
|
|
$page.find('#outloginbtn').on('tap', function () { |
|
|
|
learun.layer.confirm('确定要退出账号?', function (_index) { |
|
|
|
if (_index === '1') { |
|
|
|
learun.isOutLogin = true; |
|
|
|
if (learun.storage.get("Ip") != null && learun.storage.get("ACIp") != "") { |
|
|
|
//Ip上网 |
|
|
|
sendToAc(learun.storage.get("ACIp"), 'logout', learun.storage.get("Ip"), userinfo.baseinfo.account, ''); |
|
|
|
} |
|
|
|
if (learun.storage.get("Ip") != null && learun.storage.get("ACIp2") != "") { |
|
|
|
//Ip上网 |
|
|
|
sendToAc(learun.storage.get("ACIp2"), 'logout', learun.storage.get("Ip"), userinfo.baseinfo.account, ''); |
|
|
|
} |
|
|
|
learun.storage.set('logininfo', null); |
|
|
|
learun.nav.go({ path: 'login', isBack: false, isHead: false }); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, '', ['取消', '退出']); |
|
|
|
}); |
|
|
|
} |
|
|
|
}; |
|
|
|
return page; |
|
|
|
})(); |