private void SendCredentials(bool register) { string username; string password; if (!TextFieldInput.TryGetText(UsernameInputName, out username)) { Debug.LogError("Failed to get text from username field."); return; } if (!TextFieldInput.TryGetText(PasswordInputName, out password)) { Debug.LogError("Failed to get text from password field."); return; } username = InputValidator.FmtAllLowercase(username); if (!InputValidator.IsValidEmail(username)) { Debug.LogError("Username must be a valid email address."); } else if (!InputValidator.IsValidPassword(password)) { Debug.LogError("Invalid password: Length must be between " + InputValidator.MinPasswordLength + " and " + InputValidator.MaxPasswordLength + " characters long."); } else { socket.Send(register ? "CreateAccountRequest" : "LoginRequest", loginServer, username, password); } }
private void SubmitCreate() { string playerName; if (!TextFieldInput.TryGetText(PlayerNameInput, out playerName)) { return; } if (!InputValidator.IsValidPlayerName(playerName)) { Debug.LogError("Character name must be letters only and be " + InputValidator.MinPlayerNameLength + " to " + InputValidator.MaxPlayerNameLength + " characters long."); return; } playerName = InputValidator.FmtAllLowercase(playerName); socket.Send("CreateCharacter", characterServer, playerName); uiManager.CloseAllWindows(); }