private void ResetPasswordViaNetwork() { // ENCRYPT THE EMAIL ADDRESS AND SEND TO THE SERVER TO RESET THE USER'S PASSWORD. if (Net.IsConnected) { if (App.GameUser != null) { string strEmail = EmailAddressInput.GetComponent <InputField>().text.Trim(); if (strEmail == "") { StatusMessage = "All Fields must be Completed."; } else { strEmail = Crypto.Encrypt(strEmail); App.GameUser.CmdResetPassword(strEmail); } } else { StatusMessage = "Unable to Communicate with the Server"; } } else { StatusMessage = "Not Connected to the Server"; } }
private void SignUpViaNetwork() { // ENCRYPT THE USERNAME, PASSWORD AND EMAIL ADDRESS. // SEND TO THE SERVER TO CREATE A NEW USER ACCOUNT. if (Net.IsConnected) { if (App.GameUser != null) { string strUsername = UsernameInput.GetComponent <InputField>().text.Trim(); string strPassword = PasswordInput.GetComponent <InputField>().text.Trim(); string strEmail = EmailAddressInput.GetComponent <InputField>().text.Trim(); if (strUsername == "" || strPassword == "" || strEmail == "") { StatusMessage = "All Fields must be Completed."; } else { strUsername = Crypto.Encrypt(strUsername); strPassword = Crypto.Encrypt(strPassword); strEmail = Crypto.Encrypt(strEmail); App.GameUser.CmdNewUserSignUp(strUsername, strPassword, strEmail); } } else { StatusMessage = "Unable to Communicate with the Server"; } } else { StatusMessage = "Not Connected to the Server"; } }
public void DisplayPanel(bool blnClearFields = false) { #if USES_STATUSMANAGER Status.UpdateStatus(); #endif if (blnClearFields) { if (UsernameInput.GetComponent <InputField>().interactable) { UsernameInput.GetComponent <InputField>().text = ""; } PasswordInput.GetComponent <InputField>().text = ""; EmailAddressInput.GetComponent <InputField>().text = ""; } if (Net == null || !Net.IsConnected || App.IsLoggedIn) { // TURN EVERYTHING OFF this.GetComponent <Image>().enabled = false; for (int i = 0; i < this.transform.childCount; i++) { this.transform.GetChild(0).GetChild(i).gameObject.SetActive(false); } } else { // TURN EVERYTHING ON this.GetComponent <Image>().enabled = true; for (int i = 0; i < this.transform.childCount - 1; i++) { this.transform.GetChild(0).GetChild(i).gameObject.SetActive(true); } // MODIFY WHICH BUTTONS/INPUTFIELDS ARE ACTIVE BASED ON THE STATE if (App.UserLoginType == 2) // WINDOWS USERNAME LOGIN TYPE { UsernameInput.GetComponent <InputField>().interactable = false; PasswordContainer.SetActive(false); EmailAddressContainer.SetActive(false); ResetPasswordLabel.SetActive(false); ForgotPasswordContainer.SetActive(false); SignUpButton.SetActive(false); LoginButton.SetActive(!App.IsWorkingOffline && !Net.ForceOffline); UsernameInput.GetComponent <InputField>().text = App.GetWindowsUsername(); UsernameInput.GetComponent <InputField>().MoveTextEnd(false); UsernameInput.GetComponent <InputField>().DeactivateInputField(); EventSystem.current.SetSelectedGameObject(UsernameInput.GetComponent <InputField>().gameObject, null); UsernameInput.GetComponent <InputField>().OnPointerClick(new PointerEventData(EventSystem.current)); } else { UsernameInput.GetComponent <InputField>().interactable = true; UsernameContainer.SetActive(!_blnIsForgetting); PasswordContainer.SetActive(!_blnIsForgetting); EmailAddressContainer.SetActive(_blnIsSigningUp || _blnIsForgetting); ForgotPasswordContainer.SetActive(!_blnIsForgetting && !_blnIsSigningUp); ResetPasswordLabel.SetActive(_blnIsForgetting); LoginButton.SetActive(!App.IsWorkingOffline && !Net.ForceOffline); SignUpButton.SetActive(App.AllowSignUp || _blnIsForgetting || _blnIsSigningUp); } bool blnCanOffline = (App != null && App.CanWorkOffline && App.IsWorkingOffline && !_blnIsForgetting && !_blnIsSigningUp); #if USES_DATABASEMANAGER blnCanOffline = blnCanOffline && Database != null && Database.ClientsCanUse; #else blnCanOffline = false; #endif OfflineButton.SetActive(blnCanOffline); // ACTIVATE/DEACTIVATE BUTTONS BASED ON ACTIVE LOGIN (IE, GAME VERSION IS UP TO DATE) LoginButton.GetComponent <Button>().interactable = LoginIsActive && !Net.IsWorkingOffline; ForgotPasswordButton.GetComponent <Button>().interactable = LoginIsActive && !Net.IsWorkingOffline; SignUpButton.GetComponent <Button>().interactable = LoginIsActive && !Net.IsWorkingOffline && (App.AllowSignUp || _blnIsForgetting || _blnIsSigningUp); OfflineButton.GetComponent <Button>().interactable = LoginIsActive; } }