AuthenticationType is now configurable from /Settings/System.

This commit is contained in:
Mark McDowall 2011-10-07 16:24:28 -07:00
parent f973c74c87
commit f627b551fc
3 changed files with 26 additions and 0 deletions

View File

@ -189,9 +189,21 @@ namespace NzbDrone.Web.Controllers
public ActionResult System()
{
var selectedAuthenticationType = _configFileProvider.AuthenticationType;
var authenticationTypes = new List<AuthenticationType>();
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();
}

View File

@ -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; }
}
}

View File

@ -31,6 +31,11 @@
<span class="small">@Html.DescriptionFor(m => m.Port)</span>
</label>
@Html.TextBoxFor(m => m.Port, new { @class = "inputClass" })
<label class="labelClass">@Html.LabelFor(m => m.AuthenticationType)
<span class="small">@Html.DescriptionFor(m => m.AuthenticationType)</span>
</label>
@Html.DropDownListFor(m => m.AuthenticationType, Model.AuthTypeSelectList, new { @class = "inputClass" })
<button type="submit" id="save_button" disabled="disabled">Save</button>
}