示例#1
0
        public IEnumerator RegisterUser(RegistrationDataModel rdm, Action <string> callback, Action <string> errorCallback)
        {
            string uri      = CHOOSE_HEALTHIER_URI + "user/register/";
            string formData = "username="******"@", "%40") + "&password="******"&email=" + rdm.email.Replace("@", "%40");

            Debug.LogWarning(uri + " " + formData);
            yield return(StartCoroutine(_PerformRequest <string>(uri, formData, callback, errorCallback)));
        }
示例#2
0
		IEnumerator TestUserRegistration() {

			RegistrationDataModel rdm = new RegistrationDataModel();
			rdm.username = "******";
			rdm.password = "******";
			rdm.email = "*****@*****.**";
			rdm.legal_accept = "1";

			yield break;
		}
示例#3
0
        IEnumerator TestUserRegistration()
        {
            RegistrationDataModel rdm = new RegistrationDataModel();

            rdm.username     = "******";
            rdm.password     = "******";
            rdm.email        = "*****@*****.**";
            rdm.legal_accept = "1";

            yield break;
        }
		public void OnRegistrationFailure(string error)
		{
			_registering = false;
			DetermineSignUpButtonStatus();
			tempRegistrationData = null;

			Debug.LogError("Registration error: " + error);
			ITTGoogleAnalytics.Instance.googleAnalytics.LogEvent(new EventHitBuilder()
			                                                     .SetEventCategory("Registration - Registration Screen")
			                                                     .SetEventAction("Registration Failure - Registration Screen")
			                                                     .SetEventLabel("User had a registration error: " + error));
			if (error.Contains("406"))
			{
				// Get the 406 message
				string[] parts = error.Split(':');
				string msg = parts[parts.Length-1];
				ModalPopupOK.Spawn(msg);
			}
			else if (error.Contains("409") || error.ToLower().Contains("already taken"))
			{
				// Technically this error means the user name is in use, but since we don't have a username field... :/
				ModalPopupOK.Spawn("This email address is already in use.");
			}
			else if (error.Contains(HelperMethods.Instance.Error_NetworkRadioOff) || error.Contains(HelperMethods.Instance.Error_NetworkTimeOut))
			{
				ModalPopupOK.Spawn("Experiencing connection issues with the server. Please check your connection.", () => {
					StartCoroutine(OnHide());
				});
			}
			else if (!error.Contains("200"))
			{
				ModalPopupOK.Spawn("An error occurred. Error: " + error);
			}
			else
			{
				ModalPopupOK.Spawn("An error occurred. Please try again later.");
			}
		}
		public void OnSignUpPressed()
		{
			if (string.IsNullOrEmpty(model.registrationEmail.value) || string.IsNullOrEmpty(model.registrationPassword.value) || string.IsNullOrEmpty(model.registrationConfirmPassword.value))
			{
				ModalPopupOK.Spawn("Please ensure all fields are filled out.");
			}
			else if (model.registrationPassword.value != model.registrationConfirmPassword.value)
			{
				ModalPopupOK.Spawn("Passwords do not match.");
			}
			else if (!model.registrationAcceptTerms.value)
			{
				ModalPopupOK.Spawn("You must accept the terms and conditions to register a new account.");
			}
			else
			{
				tempRegistrationData = new RegistrationDataModel();
				tempRegistrationData.email = model.registrationEmail.value;
				int atIndex = model.registrationEmail.value.IndexOf('@');
				if (0 > atIndex)
				{
					ModalPopupOK.Spawn("The email address has been entered incorrectly.");
					return;
				}

				tempRegistrationData.username = model.registrationEmail.value;
				tempRegistrationData.password = model.registrationPassword.value;
				tempRegistrationData.legal_accept = (model.registrationAcceptTerms.value ? "1" : "0");

				// TODO: actual call
				_registering = true;
				DetermineSignUpButtonStatus();
				ITTGoogleAnalytics.Instance.googleAnalytics.LogEvent(new EventHitBuilder()
				                                                     .SetEventCategory("Registration - Registration Screen")
				                                                     .SetEventAction("Click - Sign Up Button")
				                                                     .SetEventLabel("User has clicked the sign up button. Username: "******" Legal: " + tempRegistrationData.legal_accept.ToString()));
				ITTDataCache.Instance.RegisterUser(tempRegistrationData, OnRegistrationSuccess, OnRegistrationFailure);
			}
		}
示例#6
0
 public void RegisterUser(RegistrationDataModel rdm, Action <string> callback, Action <string> errorCallback)
 {
     StartCoroutine(_networkManager.RegisterUser(rdm, callback, errorCallback));
 }