119 lines
5.1 KiB
HTML
119 lines
5.1 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
|
|
<head>
|
|
<title></title>
|
|
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=0, shrink-to-fit=no">
|
|
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
|
|
<link href="/jscss/style.css" rel="stylesheet" type="text/css" />
|
|
<script type="text/javascript" charset="utf-8" src="/jscss/theme.js"></script>
|
|
</head>
|
|
|
|
<body>
|
|
<div class="container">
|
|
<fieldset style="margin:8em auto 2em auto;width:22em;display: block;" class="tips">
|
|
<legend class="lang">修改密码</legend>
|
|
<div style="padding:1em;" class="char5">
|
|
<form>
|
|
<div class="ciy-form">
|
|
<label class="lang">原密码</label>
|
|
<div>
|
|
<input type="password" name="oldpass" />
|
|
</div>
|
|
</div>
|
|
<div class="ciy-form">
|
|
<label class="lang">新密码</label>
|
|
<div>
|
|
<input type="password" name="newpass" />
|
|
</div>
|
|
</div>
|
|
<div class="ciy-form">
|
|
<label class="lang">重复密码</label>
|
|
<div>
|
|
<input type="password" name="pass2" />
|
|
</div>
|
|
</div>
|
|
<div class="ciy-form">
|
|
<div style='text-align:center;'>
|
|
<button type="button" class="lang btn lg" onclick="javascript:update(this);">修改密码</button>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</fieldset>
|
|
<div style="position: absolute;bottom:0;right:0;text-align: right;padding:0.5em 1em;">
|
|
<a onclick="javascript:storagesize();">计算缓存大小</a><br />
|
|
<a onclick="javascript:clearall();">清理缓存重新登录</a><br />
|
|
</div>
|
|
</div>
|
|
|
|
<script type="text/javascript" src="/jscss/ciy.js"></script>
|
|
<script type="text/javascript" src="../common.js"></script>
|
|
<script type="text/javascript">
|
|
'use strict';
|
|
async function update(dom) {
|
|
var postparam = ciyfn.getform(dom);
|
|
console.log(postparam);
|
|
if (postparam.oldpass == "")
|
|
return ciyfn.alert("请填写原密码");
|
|
if (postparam.newpass == "")
|
|
return ciyfn.alert("请填写新密码");
|
|
if (postparam.newpass == postparam.oldpass)
|
|
return ciyfn.alert("新旧密码不要相同");
|
|
if (postparam.newpass != postparam.pass2)
|
|
return ciyfn.alert("两次填写的密码要相同");
|
|
if (postparam.newpass.length < 6)
|
|
return errjson('新密码应至少6位');
|
|
// if (!/[@#$%^&*()_+!]/.test(postparam.newpass))
|
|
// return ciyfn.alert('新密码应包含特殊符号@#$%^&*()_+!');
|
|
if (!/[a-z]/.test(postparam.newpass))
|
|
return ciyfn.alert('新密码应包含小写字母');
|
|
if (!/[A-Z]/.test(postparam.newpass))
|
|
return ciyfn.alert('新密码应包含大写字母');
|
|
if (!/[0-9]/.test(postparam.newpass))
|
|
return ciyfn.alert('新密码应包含数字');
|
|
postparam.oldpass = await ciyfn.sha256(postparam.oldpass + ciy_vars.tokensalt);
|
|
postparam.newpass = await ciyfn.sha256(postparam.newpass + ciy_vars.tokensalt);
|
|
delete postparam.pass2;
|
|
ciyfn.callfunc("update", postparam, function (json) {
|
|
ciyfn.alert('密码修改成功');
|
|
var me = ciyfn.getstorage(ciy_vars.tokenfield);
|
|
me.needpass = false;
|
|
ciyfn.setstorage(ciy_vars.tokenfield, me);
|
|
ciyfn.sendsignal(window.top, 'manage_ifrclose');
|
|
});
|
|
}
|
|
function storagesize() {
|
|
var size = 0;
|
|
for (var i = 0; i < window.localStorage.length; i++) {
|
|
var key = window.localStorage.key(i);
|
|
var value = window.localStorage.getItem(key);
|
|
size += key.length * 2;
|
|
size += gb_strlen(value) * 2;
|
|
}
|
|
ciyfn.alert('缓存占用空间: ' + (size / 1024).toFixed(2) + 'KB');
|
|
}
|
|
function gb_strlen(val) {
|
|
var len = 0;
|
|
for (var i = 0; i < val.length; i++) {
|
|
if (val.charCodeAt(i) < 256)
|
|
len += 1;
|
|
else
|
|
len += 2;
|
|
}
|
|
return len;
|
|
}
|
|
function clearall() {
|
|
ciyfn.alert('清理缓存重新登录?', function (opn) {
|
|
opn.close();
|
|
if (opn.btn == "继续") {
|
|
window.localStorage.clear();
|
|
top.location.href = './';
|
|
}
|
|
}, { btns: ["继续", "*关闭"] });
|
|
}
|
|
</script>
|
|
</body>
|
|
|
|
</html> |