fix login error
This commit is contained in:
parent
a02212bbb7
commit
3b3efe5791
@ -45,7 +45,8 @@ r.post('/login', koaBody(), async (c, n) => {
|
|||||||
let values = [c.request.body.account]
|
let values = [c.request.body.account]
|
||||||
let userAcc = await c.db.query({text, values})
|
let userAcc = await c.db.query({text, values})
|
||||||
if (userAcc.rowCount === 0) throw genError('NotFound', 'user not found')
|
if (userAcc.rowCount === 0) throw genError('NotFound', 'user not found')
|
||||||
if (!comparePassword(c.request.body.password, userAcc.rows[0].password)) throw genError('DataFormat', 'account or password error')
|
let matchPass = await comparePassword(c.request.body.password, userAcc.rows[0].password)
|
||||||
|
if (!matchPass) throw genError('DataFormat', 'account or password error')
|
||||||
|
|
||||||
let user = userAcc.rows[0]
|
let user = userAcc.rows[0]
|
||||||
delete user.password
|
delete user.password
|
||||||
|
Loading…
Reference in New Issue
Block a user