Browse Source

Show a notice when the user doesn't have a password.

pull/6/head
t123yh 7 years ago
parent
commit
8c52dd42de
  1. 1
      modules/api.js
  2. 3
      views/login.ejs

1
modules/api.js

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

3
views/login.ejs

@ -73,6 +73,9 @@ function login() {
case 1002:
show_error("密码错误");
break;
case 1003:
show_error("您尚未设置密码,请通过下方「找回密码」来设置您的密码。");
break;
case 1:
success(data.session_id);
return;

Loading…
Cancel
Save