private void Apply() { if (OldPassword.IsNullOrEmpty()) { TMessageBox.Show("Old password is required !"); return; } if (Password.IsNullOrEmpty()) { TMessageBox.Show("Password is required !"); return; } if (ReEnterPassword.IsNullOrEmpty()) { TMessageBox.Show("Re-Enter Password is required !"); return; } if (Password != ReEnterPassword) { TMessageBox.Show("Password re-entered incorrectly!"); return; } Parent.SaveApplicationPassword(Password); //TODO: Save Application Password //TMessageBox.Show("Password saved successfully."); _Form.Close(); }
public IEnumerable <ValidationResult> Validate(ValidationContext validationContext) { if (Token.IsNullOrEmpty() && OldPassword.IsNullOrEmpty()) { yield return(new ValidationResult( string.Format(Resource.Required, Resource.OldPassword), new[] { "OldPassword" })); } var regex = new Regex( IsAdmin ? ConfigurationReader.AdminPasswordRegex : ConfigurationReader.UserPasswordRegex); if (!regex.IsMatch(Password)) { yield return(new ValidationResult( IsAdmin ? Resource.AdminPasswordValidationMessage : Resource.PasswordValidationMessage, new[] { "Password" })); } }