Gets more validation bits wired up. Server side validation is now working which is based on val-server-field since we can use this natively with the asp.net ModelState result instead of the val-server which is actually to be used with PropertyType (Property Editors). Next up is validation for the different tabs of the editor.
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Web.Http;
|
||||
using System.Web.Http.Controllers;
|
||||
using System.Web.Http.Validation;
|
||||
|
||||
namespace Umbraco.Web.WebApi
|
||||
{
|
||||
/// <summary>
|
||||
/// Applying this attribute to any webapi controller will ensure that it only contains one json formatter compatible with the angular json vulnerability prevention.
|
||||
/// </summary>
|
||||
internal class PrefixlessBodyModelValidatorAttribute : Attribute, IControllerConfiguration
|
||||
{
|
||||
public virtual void Initialize(HttpControllerSettings controllerSettings, HttpControllerDescriptor controllerDescriptor)
|
||||
{
|
||||
//replace the normal validator with our custom one for this controller
|
||||
controllerSettings.Services.Replace(typeof(IBodyModelValidator),
|
||||
new PrefixlessBodyModelValidator(controllerSettings.Services.GetBodyModelValidator()));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user