private void AlreadyHaveAccount_Clicked(object sender, EventArgs e) { CreateAccountGrid.FadeTo(0, 1000); CreateAccountGrid.IsVisible = false; SignInGrid.IsVisible = true; SignInGrid.FadeTo(1, 1000); }
private async void SignUp_Clicked(object sender, EventArgs e) { CreateAccountError.IsVisible = false; if (string.IsNullOrEmpty(NewEmailEntry.Text) || string.IsNullOrEmpty(NewPasswordEntry.Text) || string.IsNullOrEmpty(NewPasswordConfirmEntry.Text)) { CreateAccountError.Text = "Please fill in all fields."; CreateAccountError.IsVisible = true; return; } else if (!RegexHelper.IsValidEmail(NewEmailEntry.Text)) { CreateAccountError.Text = "Please enter a valid email address."; CreateAccountError.IsVisible = true; return; } else if (string.Compare(NewPasswordEntry.Text, NewPasswordConfirmEntry.Text) != 0) { CreateAccountError.Text = "The two passwords do not match. Please try Again."; CreateAccountError.IsVisible = true; return; } else if (NewPasswordEntry.Text.Length < 8 || !NewPasswordEntry.Text.Any(char.IsDigit) || !NewPasswordEntry.Text.Any(char.IsUpper) || !NewPasswordEntry.Text.Any(char.IsLower)) { CreateAccountError.Text = "Your password must be at least 8 characters with an upercase letter, lowercase letter and a number"; CreateAccountError.IsVisible = true; return; } Loading.IsVisible = true; CognitoContext context = await _cognitoHelper.SignUp(NewEmailEntry.Text.ToLower(), NewPasswordEntry.Text); switch (context.Result) { case CognitoResult.PasswordRequirementsFailed: CreateAccountError.Text = "Your password must be at least 8 characters with an upercase letter, lowercase letter and a number"; CreateAccountError.IsVisible = true; Loading.IsVisible = false; break; case CognitoResult.UserNameAlreadyUsed: CreateAccountError.Text = "There is already an account using that email address."; CreateAccountError.IsVisible = true; Loading.IsVisible = false; break; case CognitoResult.SignupOk: Loading.IsVisible = false; CreateAccountGrid.FadeTo(0, 1000); CreateAccountGrid.IsVisible = false; ConfirmEmailGrid.IsVisible = true; ConfirmEmailGrid.FadeTo(1, 1000); break; default: CreateAccountError.Text = "Something went wrong. Please try again later."; CreateAccountError.IsVisible = true; Loading.IsVisible = false; break; } }