bool FieldChecker(object value) { #region Check data string temp; if ((temp = ValidateUserData.ValidateEmail(Email, true)) != null) { FieldState = ControlStates.EmailError; ErrorMessage = temp; return(false); } if ((temp = ValidateUserData.ValidatePassword((SecureString)value, true)) != null) { FieldState = ControlStates.PasswordError; ErrorMessage = temp; return(false); } #endregion ShowErrorMessage(""); FieldState = ControlStates.NormalGray; return(true); }
bool FieldChecker(SecureString[] values) { string temp; if ((temp = ValidateUserData.ValidateUserName(UserName, true)) != null) { ErrorMessage = temp; FieldState = ControlStates.UserNameError; return(false); } if ((temp = ValidateUserData.ValidateEmail(Email, true)) != null) { FieldState = ControlStates.EmailError; ErrorMessage = temp; return(false); } if ((temp = ValidateUserData.ValidatePassword(values, true)) != null) { FieldState = ControlStates.PasswordError; ErrorMessage = temp; return(false); } ErrorMessage = ""; FieldState = ControlStates.NormalGray; return(true); }
async void changeUserPass(object objects) { var oldPass = (objects as IHaveThreePasswords).OldStringPassword; var newPass = (objects as IHaveThreePasswords).StringPassword; var repeatNewPass = (objects as IHaveThreePasswords).RepeatStringPassword; string temp; // Validate new password if ((temp = ValidateUserData.ValidatePassword(new SecureString[] { newPass, repeatNewPass }, true)) != null) { ChangePassErrorMessage = temp; FieldState = ControlStates.PasswordError; return; } var errorMess = await UnitOfWork.ChangePassword(oldPass.GetHash(), newPass.GetHash()); if (errorMess != null) { ChangePassErrorMessage = errorMess; FieldState = ControlStates.PasswordError; return; } //If all ok ChangePassErrorMessage = ""; FieldState = ControlStates.NormalGray; }