Merge branch 'master' into release

This commit is contained in:
Jay 2018-08-23 20:16:03 +08:00
commit e123affea2

View File

@ -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