diff --git a/server/app/config/storage/host-list.json b/server/app/config/storage/host-list.json index 0637a08..af21d54 100644 --- a/server/app/config/storage/host-list.json +++ b/server/app/config/storage/host-list.json @@ -1 +1,6 @@ -[] \ No newline at end of file +[ + { + "host": "localhost", + "name": "test" + } +] \ No newline at end of file diff --git a/server/app/controller/user.js b/server/app/controller/user.js index cfec853..28d1cbe 100644 --- a/server/app/controller/user.js +++ b/server/app/controller/user.js @@ -44,11 +44,12 @@ const login = async ({ res, request }) => { const updatePwd = async ({ res, request }) => { let { body: { oldPwd, newPwd } } = request - oldPwd = SHA1Encrypt(RSADecrypt(oldPwd)) - newPwd = SHA1Encrypt(RSADecrypt(newPwd)) - + let rsaOldPwd = RSADecrypt(oldPwd) + oldPwd = rsaOldPwd === 'admin' ? 'admin' : SHA1Encrypt(rsaOldPwd) let keyObj = readKey() if(oldPwd !== keyObj.pwd) return res.fail({ data: false, msg: '旧密码校验失败' }) + // 旧密钥校验通过,加密保存新密码 + newPwd = SHA1Encrypt(RSADecrypt(newPwd)) keyObj.pwd = newPwd writeKey(keyObj) res.success({ data: true, msg: 'success' }) diff --git a/yarn.lock b/yarn.lock index f1f5188..1ba95de 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2725,11 +2725,6 @@ supports-preserve-symlinks-flag@^1.0.0: resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09" integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w== -systeminformation@^5.11.16: - version "5.11.22" - resolved "https://registry.yarnpkg.com/systeminformation/-/systeminformation-5.11.22.tgz#52eb78fd6bb48eef372f502b494ff59aacf82c02" - integrity sha512-sBZJ/WBCf2vDLeMZaEyVuo+aXylOSmNHHB2cX0jHULFxSBLXHX+QUHYrCvmz+YiflKY3bsahVWX7vwuz1p1QZA== - table@^6.0.9: version "6.8.0" resolved "https://registry.yarnpkg.com/table/-/table-6.8.0.tgz#87e28f14fa4321c3377ba286f07b79b281a3b3ca"