/// <summary> /// Handles all validation of Credentials for sign up /// </summary> /// <returns>The credentials.</returns> public CredentialInformation ValidateCredentials() { CredentialInformation CredInfo = new CredentialInformation(); if (!IsProperUsername()) { CredInfo.Errors.Add("Invalid Username"); } if (!PasswordsMatch()) { CredInfo.Errors.Add("Passwords do not match"); } if (!IsProperPassword()) { CredInfo.Errors.Add("Password must have 1 uppercase and special character and be 8 letters long"); } if (UserExists()) { CredInfo.Errors.Add("Username already exists"); } if (CredInfo.IsValid()) { string _temp = HttpUtils.PostInfo(new List <KeyValuePair <string, string> > { new KeyValuePair <string, string>("username", TryUsername.Text), new KeyValuePair <string, string>("user_password", TryPassword.Text) }, "http://haydenszymanski.me/softeng05/register_participant.php").ResponseInfo; } return(CredInfo); }
/// <summary> /// When the next button is clicked, we run all the credentials through to see if the meet our ideal criteria for a properly /// formed set of credentials. /// Upon success we update the database with the new user and the local current user static fields /// </summary> void OnNextClick(object sender, EventArgs e) { CredentialInformation CredInfo = ValidateCredentials(); if (!CredInfo.IsValid()) { DisplayAlert("Error", CredInfo.ErrorsAsString(), "Continue"); } else { Task.Run(async() => { ActiveUser = await HttpUtils.GetJsonInfo <User>( new List <KeyValuePair <string, string> > { new KeyValuePair <string, string>("username", TryUsername.Text), new KeyValuePair <string, string>("user_password", TryPassword.Text) }, "http://haydenszymanski.me/softeng05/get_user.php"); Device.BeginInvokeOnMainThread(() => { Navigation.InsertPageBefore(new ProfileUpdatePage(ActiveUser), Navigation.NavigationStack.First()); Navigation.PopToRootAsync(); }); }); } }
/// <summary> /// Handles all validation of Credentials for sign up /// </summary> /// <returns>The credentials.</returns> public CredentialInformation ValidateCredentials() { CredentialInformation CredInfo = new CredentialInformation(); if (!IsProperUsername()) { CredInfo.Errors.Add("Invalid Username"); } if (!PasswordsMatch()) { CredInfo.Errors.Add("Passwords do not match"); } if (!IsProperPassword()) { CredInfo.Errors.Add("Password is not proper"); } if (UserExists()) { CredInfo.Errors.Add("Username already exists"); } if (CredInfo.IsValid()) { PostRequest post = new PostRequest(); string hi = post.PostInfo(new List <KeyValuePair <string, string> > { new KeyValuePair <string, string>("username", TryUsername.Text), new KeyValuePair <string, string>("user_password", TryPassword.Text) }, "http://haydenszymanski.me/softeng05/register_participant.php").ResponseInfo; } return(CredInfo); }