internal void SetErrors(DataSubmitErrorArgs dataSubmitErrorArgs) { if (!Dispatcher.CheckAccess()) Dispatcher.Invoke(new Action(() => SetErrors(dataSubmitErrorArgs))); else { ResetStatus(); bool foundError = false; if (dataSubmitErrorArgs.HasError(DataSubmitErrorCode.InUse) && dataSubmitErrorArgs.HasErrorField("email")) { Email.Background = new SolidColorBrush(Colors.MistyRose); _validator.SetError("Email address in use"); foundError = true; } if (dataSubmitErrorArgs.HasError(DataSubmitErrorCode.InUse) && dataSubmitErrorArgs.HasErrorField("username")) { Username.Background = new SolidColorBrush(Colors.MistyRose); _validator.SetError("Username already in use"); foundError = true; } if (dataSubmitErrorArgs.HasError(DataSubmitErrorCode.NotComplexEnough)) { Password.Background = new SolidColorBrush(Colors.MistyRose); _validator.SetError("Password is insecure"); foundError = true; } if (!foundError) { _validator.SetError("Unknown Error"); } } }
public bool LoginFailed(DataSubmitErrorArgs dataSubmissionErrors) { if (dataSubmissionErrors.HasErrorField("PasswordHash")) { Password.Password = ""; Validate(); return true; } else if (dataSubmissionErrors.HasError(DataSubmitErrorCode.DataIncomplete)) { Password.Password = ""; Username.Text = ""; Validate(); return true; } return false; }