diff --git a/src/Umbraco.Web/WebApi/Binders/MemberBinder.cs b/src/Umbraco.Web/WebApi/Binders/MemberBinder.cs index 7a1913ce1a..0877828e8e 100644 --- a/src/Umbraco.Web/WebApi/Binders/MemberBinder.cs +++ b/src/Umbraco.Web/WebApi/Binders/MemberBinder.cs @@ -235,6 +235,14 @@ namespace Umbraco.Web.WebApi.Binders return base.ValidatePropertyData(postedItem, actionContext); } + /// + /// This ensures that the internal membership property types are removed from validation before processing the validation + /// since those properties are actually mapped to real properties of the IMember. + /// This also validates any posted data for fields that are sensitive. + /// + /// + /// + /// protected override bool ValidateProperties(ContentItemBasic postedItem, HttpActionContext actionContext) { var propertiesToValidate = postedItem.Properties.ToList(); @@ -245,9 +253,15 @@ namespace Umbraco.Web.WebApi.Binders propertiesToValidate.RemoveAll(property => property.Alias == remove); } - return ValidateProperties(propertiesToValidate.ToArray(), postedItem.PersistedContent.Properties.ToArray(), actionContext); - } + var sensitiveProperties = postedItem.PersistedContent.ContentType + .PropertyTypes.Where(x => postedItem.PersistedContent.ContentType.IsSensitiveProperty(x.Alias)) + .ToList(); + //TODO: Finish this validation + + return ValidateProperties(propertiesToValidate, postedItem.PersistedContent.Properties.ToList(), actionContext); + } + internal bool ValidateUniqueLogin(MemberSave contentItem, MembershipProvider membershipProvider, HttpActionContext actionContext) { if (contentItem == null) throw new ArgumentNullException("contentItem"); @@ -333,4 +347,4 @@ namespace Umbraco.Web.WebApi.Binders } } } -} \ No newline at end of file +} diff --git a/src/Umbraco.Web/WebApi/Filters/ContentItemValidationHelper.cs b/src/Umbraco.Web/WebApi/Filters/ContentItemValidationHelper.cs index 2103aa1ee8..3027443da8 100644 --- a/src/Umbraco.Web/WebApi/Filters/ContentItemValidationHelper.cs +++ b/src/Umbraco.Web/WebApi/Filters/ContentItemValidationHelper.cs @@ -74,7 +74,7 @@ namespace Umbraco.Web.WebApi.Filters /// protected virtual bool ValidateProperties(ContentItemBasic postedItem, HttpActionContext actionContext) { - return ValidateProperties(postedItem.Properties.ToArray(), postedItem.PersistedContent.Properties.ToArray(), actionContext); + return ValidateProperties(postedItem.Properties.ToList(), postedItem.PersistedContent.Properties.ToList(), actionContext); } /// @@ -84,7 +84,7 @@ namespace Umbraco.Web.WebApi.Filters /// /// /// - protected bool ValidateProperties(ContentPropertyBasic[] postedProperties , Property[] persistedProperties, HttpActionContext actionContext) + protected bool ValidateProperties(List postedProperties , List persistedProperties, HttpActionContext actionContext) { foreach (var p in postedProperties) {