|
@@ -27,6 +27,16 @@ namespace JLHHJSvr.Excutor
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
+ var remoteIP = string.Empty;
|
|
|
+ var remoteInfo = state as IRemoteInfoContainer;
|
|
|
+ var remoteEndPoint = remoteInfo?.RemoteInfo;
|
|
|
+ if (!string.IsNullOrEmpty(remoteEndPoint))
|
|
|
+ {
|
|
|
+ var pos = remoteEndPoint.LastIndexOf(":");
|
|
|
+ remoteIP = pos > 0 ? remoteEndPoint.Substring(0, pos).Trim() : remoteEndPoint;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
//if (string.IsNullOrEmpty(request.psw))
|
|
|
//{
|
|
|
// rslt.ErrMsg = "密码不能为空";
|
|
@@ -43,7 +53,7 @@ namespace JLHHJSvr.Excutor
|
|
|
{
|
|
|
if (DbSqlHelper.SelectOne(cmd, "u_user_jlhprice", "userid = @usercode",
|
|
|
new Dictionary<string, object>() { { "@usercode", request.usercode } }, stUser,
|
|
|
- "userid, empid, username, usermode, psw, access_failed_count, last_failed_attempt_time") != 1)
|
|
|
+ "userid, empid, username, usermode, psw, access_failed_count, last_failed_attempt_time,whiteIPs") != 1)
|
|
|
{
|
|
|
rslt.ErrMsg = "用户名不存在或密码错误";
|
|
|
return;
|
|
@@ -55,6 +65,15 @@ namespace JLHHJSvr.Excutor
|
|
|
throw new LJCommonException("登录连续错误5次,账号已锁定,请联系管理员解锁!");
|
|
|
}
|
|
|
|
|
|
+ if (!string.IsNullOrEmpty(stUser.whiteIPs) && !string.IsNullOrEmpty(remoteIP))
|
|
|
+ {
|
|
|
+ var ipSet = new HashSet<string>(stUser.whiteIPs.Split(',', ','), StringComparer.OrdinalIgnoreCase);
|
|
|
+ if (!ipSet.Contains(remoteIP))
|
|
|
+ {
|
|
|
+ throw new LJCommonException($"{request.usercode}当前使用的IP[{remoteIP}]不在白名单里,不允许登录");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
psw_bczh3 pswhelper = new psw_bczh3();
|
|
|
if (pswhelper.GetEntrypt(request.psw, 0, "123457851239866") != stUser.psw)
|
|
|
{
|