public void OnTryRegister(SvManager svManager, AuthData authData, ConnectData connectData) { if (ValidateUser(svManager, authData)) { if (svManager.TryGetUserData(authData.accountID, out User playerData)) { if (playerData.BanInfo.IsBanned) { svManager.RegisterFail(authData.connection, $"Account banned: {playerData.BanInfo.Reason}"); return; } if (!svManager.settings.auth.steam && playerData.PasswordHash != connectData.passwordHash) { svManager.RegisterFail(authData.connection, $"Invalid credentials"); return; } } if (!connectData.username.ValidCredential()) { svManager.RegisterFail(authData.connection, $"Name cannot be registered (min: {Util.minCredential}, max: {Util.maxCredential})"); return; } svManager.AddNewPlayer(authData, connectData); } }
public void OnTryRegister(SvManager svManager, ConnectionData connectData) { if (ValidateUser(svManager, connectData)) { if (svManager.TryGetUserData(connectData.username, out User playerData)) { if (playerData.PasswordHash != connectData.passwordHash) { svManager.RegisterFail(connectData.connection, "Invalid credentials"); return; } } if (!connectData.username.ValidCredential()) { svManager.RegisterFail(connectData.connection, $"Name cannot be registered (min: {Util.minCredential}, max: {Util.maxCredential})"); return; } if (!connectData.username.ValidCredential()) { svManager.RegisterFail(connectData.connection, $"Name cannot be registered (min: {Util.minCredential}, max: {Util.maxCredential})"); return; } // -- BPE EXTEND if (Core.Instance.Settings.General.LimitNames && !Regex.IsMatch(connectData.username, @"^[a-zA-Z0-9_]+$")) { svManager.RegisterFail(connectData.connection, $"Your Username can only contain letters: A-Z a-z 0-9 _ -"); return; } // BPE EXTEND -- svManager.AddNewPlayer(connectData); } }
public void OnTryRegister(SvManager svManager, ConnectionData connectionData) { if (ValidateUser(svManager, connectionData)) { if (svManager.TryGetUserData(connectionData.username, out var playerData)) { if (playerData.PasswordHash != connectionData.passwordHash) { svManager.RegisterFail(connectionData.connection, "Invalid credentials"); return; } if (!Utility.tryRegister.Limit(connectionData.username)) { svManager.RegisterFail(connectionData.connection, $"Character {connectionData.username} Exists - Sure you want to Register?"); return; } } if (!connectionData.username.ValidCredential()) { svManager.RegisterFail(connectionData.connection, $"Name cannot be registered (min: {Util.minCredential}, max: {Util.maxCredential})"); return; } svManager.AddNewPlayer(connectionData, playerData?.Persistent); } }
public void OnTryRegister(SvManager svManager, ConnectionData connectionData) { if (ValidateUser(svManager, connectionData)) { if (svManager.TryGetUserData(connectionData.username, out User playerData)) { if (Core.Instance.Settings.General.DisableAccountOverwrite) { svManager.RegisterFail(connectionData.connection, "This Name has already been registerd and this Server has disabled overwriting Accounts!"); return; } if (playerData.PasswordHash != connectionData.passwordHash) { svManager.RegisterFail(connectionData.connection, "Invalid credentials"); return; } } if (!connectionData.username.ValidCredential()) { svManager.RegisterFail(connectionData.connection, $"Name cannot be registered (min: {Util.minCredential}, max: {Util.maxCredential})"); return; } // -- BPE EXTEND if (Core.Instance.Settings.General.LimitNames && !Regex.IsMatch(connectionData.username, @"^[a-zA-Z0-9_-]+$")) { svManager.RegisterFail(connectionData.connection, $"Your Username can only contain letters: A-Z a-z 0-9 _ -"); return; } // BPE EXTEND -- svManager.AddNewPlayer(connectionData, playerData?.Persistent); } }