From f627b551fc23cc636a22911f7d66e92ec39ef63e Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Fri, 7 Oct 2011 16:24:28 -0700 Subject: [PATCH] AuthenticationType is now configurable from /Settings/System. --- NzbDrone.Web/Controllers/SettingsController.cs | 13 +++++++++++++ NzbDrone.Web/Models/SystemSettingsModel.cs | 8 ++++++++ NzbDrone.Web/Views/Settings/System.cshtml | 5 +++++ 3 files changed, 26 insertions(+) diff --git a/NzbDrone.Web/Controllers/SettingsController.cs b/NzbDrone.Web/Controllers/SettingsController.cs index 0620b792c..84bf6f023 100644 --- a/NzbDrone.Web/Controllers/SettingsController.cs +++ b/NzbDrone.Web/Controllers/SettingsController.cs @@ -189,9 +189,21 @@ namespace NzbDrone.Web.Controllers public ActionResult System() { + var selectedAuthenticationType = _configFileProvider.AuthenticationType; + var authenticationTypes = new List(); + + foreach (AuthenticationType authenticationType in Enum.GetValues(typeof(AuthenticationType))) + { + authenticationTypes.Add(authenticationType); + } + + var authTypeSelectList = new SelectList(authenticationTypes, selectedAuthenticationType); + var model = new SystemSettingsModel(); model.Port = _configFileProvider.Port; model.LaunchBrowser = _configFileProvider.LaunchBrowser; + model.AuthenticationType = selectedAuthenticationType; + model.AuthTypeSelectList = authTypeSelectList; return View(model); } @@ -455,6 +467,7 @@ namespace NzbDrone.Web.Controllers { _configFileProvider.Port = data.Port; _configFileProvider.LaunchBrowser = data.LaunchBrowser; + _configFileProvider.AuthenticationType = data.AuthenticationType; return GetSuccessResult(); } diff --git a/NzbDrone.Web/Models/SystemSettingsModel.cs b/NzbDrone.Web/Models/SystemSettingsModel.cs index 25615eb77..19a17791d 100644 --- a/NzbDrone.Web/Models/SystemSettingsModel.cs +++ b/NzbDrone.Web/Models/SystemSettingsModel.cs @@ -4,6 +4,8 @@ using System.ComponentModel; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Web; +using System.Web.Mvc; +using NzbDrone.Core.Model; namespace NzbDrone.Web.Models { @@ -17,5 +19,11 @@ namespace NzbDrone.Web.Models [DisplayName("Launch Browser")] [Description("Start default webrowser when NzbDrone starts?")] public bool LaunchBrowser { get; set; } + + [DisplayName("Authentication")] + [Description("Secure the webserver with Authentication?")] + public AuthenticationType AuthenticationType { get; set; } + + public SelectList AuthTypeSelectList { get; set; } } } \ No newline at end of file diff --git a/NzbDrone.Web/Views/Settings/System.cshtml b/NzbDrone.Web/Views/Settings/System.cshtml index 2bfc9a5cb..7af233bd2 100644 --- a/NzbDrone.Web/Views/Settings/System.cshtml +++ b/NzbDrone.Web/Views/Settings/System.cshtml @@ -31,6 +31,11 @@ @Html.DescriptionFor(m => m.Port) @Html.TextBoxFor(m => m.Port, new { @class = "inputClass" }) + + + @Html.DropDownListFor(m => m.AuthenticationType, Model.AuthTypeSelectList, new { @class = "inputClass" }) }