AB#6233 - Clean up
This commit is contained in:
@@ -3,7 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace Umbraco.Core.Exceptions
|
||||
namespace Umbraco.Web.Common.Exceptions
|
||||
{
|
||||
[Serializable]
|
||||
public class HttpResponseException : Exception
|
||||
@@ -39,5 +39,16 @@ namespace Umbraco.Core.Exceptions
|
||||
|
||||
base.GetObjectData(info, context);
|
||||
}
|
||||
|
||||
public static HttpResponseException CreateValidationErrorResponse(object model)
|
||||
{
|
||||
return new HttpResponseException(HttpStatusCode.BadRequest, model)
|
||||
{
|
||||
AdditionalHeaders =
|
||||
{
|
||||
["X-Status-Reason"] = "Validation failed"
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.Filters;
|
||||
using Umbraco.Core.Exceptions;
|
||||
using Umbraco.Web.Common.Exceptions;
|
||||
|
||||
namespace Umbraco.Web.Common.Filters
|
||||
{
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Reflection;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Exceptions;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.Migrations.Install;
|
||||
using Umbraco.Net;
|
||||
using Umbraco.Web.Common.Attributes;
|
||||
using Umbraco.Web.Common.Exceptions;
|
||||
using Umbraco.Web.Install;
|
||||
using Umbraco.Web.Install.Models;
|
||||
|
||||
@@ -152,32 +151,20 @@ namespace Umbraco.Web.Common.Install
|
||||
var installException = ex as InstallException;
|
||||
if (installException != null)
|
||||
{
|
||||
throw new HttpResponseException(HttpStatusCode.BadRequest, new
|
||||
throw HttpResponseException.CreateValidationErrorResponse(new
|
||||
{
|
||||
view = installException.View,
|
||||
model = installException.ViewModel,
|
||||
message = installException.Message
|
||||
})
|
||||
{
|
||||
AdditionalHeaders =
|
||||
{
|
||||
["X-Status-Reason"] = "Validation failed"
|
||||
}
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
throw new HttpResponseException(HttpStatusCode.BadRequest,new
|
||||
throw HttpResponseException.CreateValidationErrorResponse(new
|
||||
{
|
||||
step = step.Name,
|
||||
view = "error",
|
||||
message = ex.Message
|
||||
})
|
||||
{
|
||||
AdditionalHeaders =
|
||||
{
|
||||
["X-Status-Reason"] = "Validation failed"
|
||||
}
|
||||
};
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ namespace Umbraco.Web.Macros
|
||||
{
|
||||
object key = 0;
|
||||
|
||||
if (_umbracoContextAccessor.UmbracoContext.Security.IsAuthenticated())
|
||||
if (_umbracoContextAccessor.GetRequiredUmbracoContext().Security.IsAuthenticated())
|
||||
{
|
||||
key = _memberUserKeyProvider.GetMemberProviderUserKey() ?? 0;
|
||||
}
|
||||
|
||||
@@ -74,8 +74,6 @@ namespace Umbraco.Web.Common.Macros
|
||||
|
||||
//lets render this controller as a child action
|
||||
var viewContext = new ViewContext();
|
||||
//try and extract the current view context from the route values, this would be set in the UmbracoViewPage or in
|
||||
// the UmbracoPageResult if POSTing to an MVC controller but rendering in Webforms
|
||||
|
||||
routeVals.DataTokens.Add("ParentActionViewContext", viewContext);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user