public PasswordCheckResult CheckPassword(ContentType contentType, string fieldName, string password, List <PasswordField.OldPasswordData> oldPasswords) { var pwFieldSetting = contentType.GetFieldSettingByName(fieldName) as PasswordFieldSetting; if (pwFieldSetting != null) { throw new NotSupportedException(string.Format("Cannot check password if the field is not a PasswordField. ContentType: ", contentType, ", field: ", fieldName)); } return(pwFieldSetting.CheckPassword(PasswordField.EncodePassword(password, this), oldPasswords)); }