禁止 一般模式登录

This commit is contained in:
suwings 2018-04-02 23:46:18 +08:00
parent 14bd665920
commit 6f2f707db5
2 changed files with 10 additions and 8 deletions

View File

@ -79,7 +79,7 @@ class UserCenter {
let loginUser = this.userList[username];
try {
//BUG Note: loginUser 同步问题
//第二次审查,不一
//第二次审查,
loginUser.load();
} catch (e) {
falsecb && falsecb();
@ -87,17 +87,19 @@ class UserCenter {
return false;
}
loginUser.updateLastDate();
//login登陆时使用 md5传码方式
// 目前只准许 登陆时使用 md5传码方式 ,不准传输明文
if (md5key) {
let userMd5 = loginUser.getPasswordMD5();
let md5Passworded = md5(userMd5 + md5key);
return md5Passworded == password ? truecb && truecb(loginUser) : falsecb && falsecb();
}
//一般模式
if (loginUser.isPassword(password)) {
truecb && truecb(loginUser);
return true;
}
// 一般模式
// 禁止使用一般登录模式
// if (loginUser.isPassword(password)) {
// truecb && truecb(loginUser);
// return true;
// }
}
falsecb && falsecb();
return false;

View File

@ -92,7 +92,7 @@ router.get('/login_key', function (req, res) {
}));
return;
}
//这里是 随机的 salt 与 md5key 因为用户根本不存在,则返回一个随机的类似于正常的信息,让前端判断错误
//防止轻而易举的遍历用户名,但这仍然可以通过两次或三次尝试判断用户名是否存在
res.send(JSON.stringify({