|
|
|
@ -36,6 +36,7 @@ app.post('/api/login', async (req, res) => {
|
|
|
|
|
let user = await User.fromName(req.body.username); |
|
|
|
|
|
|
|
|
|
if (!user) res.send({ error_code: 1001 }); |
|
|
|
|
else if (user.password == null || user.password === '') res.send({ error_code: 1003 }); |
|
|
|
|
else if (user.password !== req.body.password) res.send({ error_code: 1002 }); |
|
|
|
|
else { |
|
|
|
|
req.session.user_id = user.id; |
|
|
|
|