1
0
mirror of https://github.com/RaidMax/IW4M-Admin.git synced 2025-06-08 06:08:20 -05:00

Strip out color codes and spaces when checking for min length

This commit is contained in:
RaidMax 2019-08-30 09:26:16 -05:00
parent 718ad3bf7f
commit 07f72b4031

View File

@ -3,6 +3,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
using System.Linq; using System.Linq;
using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -449,7 +450,8 @@ namespace SharedLibraryCore.Database.Models
LastConnection = DateTime.UtcNow; LastConnection = DateTime.UtcNow;
Connections += 1; Connections += 1;
if (Name.Length < 3) string strippedName = Name.StripColors();
if (string.IsNullOrWhiteSpace(Name) || strippedName.Replace(" ", "").Length < 3)
{ {
CurrentServer.Logger.WriteDebug($"Kicking {this} because their name is too short"); CurrentServer.Logger.WriteDebug($"Kicking {this} because their name is too short");
Kick(loc["SERVER_KICK_MINNAME"], Utilities.IW4MAdminClient(CurrentServer)); Kick(loc["SERVER_KICK_MINNAME"], Utilities.IW4MAdminClient(CurrentServer));