✨ v1.1.0 fix update pwd bug
This commit is contained in:
parent
7db15e917e
commit
df9266b6ba
@ -1 +1,6 @@
|
|||||||
[]
|
[
|
||||||
|
{
|
||||||
|
"host": "localhost",
|
||||||
|
"name": "test"
|
||||||
|
}
|
||||||
|
]
|
@ -44,11 +44,12 @@ const login = async ({ res, request }) => {
|
|||||||
|
|
||||||
const updatePwd = async ({ res, request }) => {
|
const updatePwd = async ({ res, request }) => {
|
||||||
let { body: { oldPwd, newPwd } } = request
|
let { body: { oldPwd, newPwd } } = request
|
||||||
oldPwd = SHA1Encrypt(RSADecrypt(oldPwd))
|
let rsaOldPwd = RSADecrypt(oldPwd)
|
||||||
newPwd = SHA1Encrypt(RSADecrypt(newPwd))
|
oldPwd = rsaOldPwd === 'admin' ? 'admin' : SHA1Encrypt(rsaOldPwd)
|
||||||
|
|
||||||
let keyObj = readKey()
|
let keyObj = readKey()
|
||||||
if(oldPwd !== keyObj.pwd) return res.fail({ data: false, msg: '旧密码校验失败' })
|
if(oldPwd !== keyObj.pwd) return res.fail({ data: false, msg: '旧密码校验失败' })
|
||||||
|
// 旧密钥校验通过,加密保存新密码
|
||||||
|
newPwd = SHA1Encrypt(RSADecrypt(newPwd))
|
||||||
keyObj.pwd = newPwd
|
keyObj.pwd = newPwd
|
||||||
writeKey(keyObj)
|
writeKey(keyObj)
|
||||||
res.success({ data: true, msg: 'success' })
|
res.success({ data: true, msg: 'success' })
|
||||||
|
@ -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"
|
resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09"
|
||||||
integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==
|
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:
|
table@^6.0.9:
|
||||||
version "6.8.0"
|
version "6.8.0"
|
||||||
resolved "https://registry.yarnpkg.com/table/-/table-6.8.0.tgz#87e28f14fa4321c3377ba286f07b79b281a3b3ca"
|
resolved "https://registry.yarnpkg.com/table/-/table-6.8.0.tgz#87e28f14fa4321c3377ba286f07b79b281a3b3ca"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user