添加 - 禁止覆盖或重复登录

This commit is contained in:
suwings 2018-04-22 23:23:17 +08:00
parent a8147634b5
commit 1de0a28ba7
2 changed files with 17 additions and 0 deletions

View File

@ -30,11 +30,22 @@ MCSERVER.login = function (username, password, rand, loginSuccess, loginError, e
},
success: function (data, textStatus) {
var obj = JSON.parse(data);
//后端指令操作
if (typeof obj['ResponseValue'] == 'number') {
var commande = Number.parseInt(obj['ResponseValue']);
if (commande == 302) {
alert("您已登录,不可重复或覆盖原先登录,我们将为你跳转网页....");
window.location.href = '../';
}
return;
}
//后端警告操作
if (typeof obj['ResponseValue'] == 'string') {
alert(obj['ResponseValue']);
loginError && loginError();
return;
}
//后端正常操作,判断密码与账户
if (obj['ResponseValue']) {
loginSuccess && loginSuccess();
} else {

View File

@ -76,6 +76,12 @@ router.post('/login', function (req, res) {
return;
}
//如果已经登录,则直接跳转
if (req.session['login'] || req.session['username']) {
response.returnMsg(res, 'login/check', 302);
return;
}
//登陆次数加一
counter.plus('login');