From e082c229834e4d471796fd079945122e70dfe225 Mon Sep 17 00:00:00 2001 From: Gary Sharp Date: Thu, 6 Oct 2016 19:10:45 +1100 Subject: [PATCH] Critical function message wording Critical functions require a localhost connection. Instead of reporting 503 Service Unavailable, report a useful message. --- .../Controllers/InitialConfigController.cs | 34 ++++++++++--------- Disco.Web/Controllers/UpdateController.cs | 6 +++- 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/Disco.Web/Controllers/InitialConfigController.cs b/Disco.Web/Controllers/InitialConfigController.cs index 0d4e1057..cfb5d038 100644 --- a/Disco.Web/Controllers/InitialConfigController.cs +++ b/Disco.Web/Controllers/InitialConfigController.cs @@ -1,19 +1,19 @@ -using System; -using System.Data.SqlClient; -using System.Threading; -using System.Web.Mvc; -using Disco.Web.Models.InitialConfig; -using Disco.Data.Repository; -using System.Linq; -using System.IO; -using System.Text.RegularExpressions; -using System.IO.Compression; -using System.Management; -using System.Web; -using Disco.Services.Users; -using Disco.Services.Interop.ActiveDirectory; +using Disco.Data.Repository; using Disco.Services.Authorization; +using Disco.Services.Interop.ActiveDirectory; +using Disco.Services.Users; using Disco.Web.Areas.API.Models.Shared; +using Disco.Web.Models.InitialConfig; +using System; +using System.Data.SqlClient; +using System.IO; +using System.IO.Compression; +using System.Linq; +using System.Management; +using System.Text.RegularExpressions; +using System.Threading; +using System.Web; +using System.Web.Mvc; namespace Disco.Web.Controllers { @@ -64,10 +64,12 @@ namespace Disco.Web.Controllers protected override void OnActionExecuting(ActionExecutingContext filterContext) { - // Updated 2012-11-01 G# - Consider ServerIsCoreSKU if (!Request.IsLocal && !ServerIsCoreSKU.Value) { - filterContext.Result = new HttpStatusCodeResult(System.Net.HttpStatusCode.ServiceUnavailable, "Initial Configuration of Disco is only allowed via a local connection"); + filterContext.Result = new ContentResult() { + Content = "Initial Configuration of Disco ICT is only allowed via a localhost connection", + ContentType = "text/plain" + }; } base.OnActionExecuting(filterContext); } diff --git a/Disco.Web/Controllers/UpdateController.cs b/Disco.Web/Controllers/UpdateController.cs index 91202b70..48961068 100644 --- a/Disco.Web/Controllers/UpdateController.cs +++ b/Disco.Web/Controllers/UpdateController.cs @@ -10,7 +10,11 @@ namespace Disco.Web.Controllers { if (!Request.IsLocal && !InitialConfigController.ServerIsCoreSKU.Value) { - filterContext.Result = new HttpStatusCodeResult(System.Net.HttpStatusCode.ServiceUnavailable, "Initialization Configuration of Disco is only allowed via a local connection"); + filterContext.Result = new ContentResult() + { + Content = "Maintenance of Disco ICT is only allowed via a localhost connection", + ContentType = "text/plain" + }; } base.OnActionExecuting(filterContext); }