初始化

This commit is contained in:
robin
2022-08-14 22:39:52 +08:00
parent b7e5ee5fec
commit 26c667d76e
2 changed files with 3 additions and 4 deletions
-2
View File
@@ -12,8 +12,6 @@ module.exports = {
token: await $components.jwt.sign({}) token: await $components.jwt.sign({})
}, "登录成功") }, "登录成功")
} }
return $res.error({}, "登录失败") return $res.error({}, "登录失败")
} }
@@ -3,11 +3,12 @@
* 账号密码登陆 * 账号密码登陆
* @param {string} data.account 账号. * @param {string} data.account 账号.
* @param {string} data.password 密码. * @param {string} data.password 密码.
* @param {string} data.oid 机构id
* @return {object} res 验证是否通过. * @return {object} res 验证是否通过.
*/ */
module.exports = async (data) => { module.exports = async (data) => {
const {account, password} = data const {account, password, oid} = data
const User = await app.db.table("User").where({account}).find() const User = await app.db.table("User").where({account, to_oid: oid}).find()
if (!User) return false if (!User) return false
const {salt} = User const {salt} = User
const ver = app.components.encrypt.cryptPwdVerification(password, salt, User.password) const ver = app.components.encrypt.cryptPwdVerification(password, salt, User.password)