Esempio n. 1
0
        public static void AddFailedLogin(string acc, string ip)
        {
            FailedLoginInfo value = null;

            checked
            {
                if (banlist.TryGetValue(ip, out value))
                {
                    if (DateAndTime.Now.Subtract(value.Time).TotalMilliseconds > (double)(LoginConfig.PASSWORD_CHECK_TIME * 60 * 1000))
                    {
                        banlist.Remove(ip);
                        banlist.Add(ip, new FailedLoginInfo(acc, ip));
                    }
                    else if (value.Count + 1 >= LoginConfig.PASSWORD_CHECK_COUNT)
                    {
                        banlist.Remove(ip);
                        BannedIpController.BanIP(ip, DateAndTime.Now.AddMinutes(LoginConfig.PASSWORD_CHECK_BANTIME));
                    }
                    else
                    {
                        value.IncreseCount();
                    }
                }
                else
                {
                    banlist.Add(ip, new FailedLoginInfo(acc, ip));
                }
            }
        }
Esempio n. 2
0
 protected override void runImpl()
 {
     if (type == 2)
     {
         if (time > 0)
         {
             DateTime dateTime = DateAndTime.Now.AddMinutes(time);
             BannedIpController.BanIP(ip, dateTime);
         }
         else
         {
             BannedIpController.UnBan(ip);
         }
         SendPacket(new SM_GS_BAN_RESPONE(type, accountId, ip, time, adminObj, result: true));
     }
     else
     {
         log.Warn((object)"未实现的封禁方法!");
     }
 }