diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 000000000..c5e0d571e --- /dev/null +++ b/.travis.yml @@ -0,0 +1,10 @@ +language: csharp +solution: PlexRequests.sln +install: + - nuget restore PlexRequests.sln + - nuget install NUnit.Runners -OutputDirectory testrunner +script: + - xbuild /p:Configuration=Release PlexRequests.sln + notifications: + email: + - jamierees@outlook.com diff --git a/PlexRequests.Store/GenericRepository.cs b/PlexRequests.Store/GenericRepository.cs index 977dfc293..78ddb4d39 100644 --- a/PlexRequests.Store/GenericRepository.cs +++ b/PlexRequests.Store/GenericRepository.cs @@ -60,7 +60,7 @@ namespace PlexRequests.Store public T Get(string id) { - throw new NotImplementedException(); + throw new NotSupportedException("Get(string) is not supported. Use Get(int)"); } public T Get(int id) diff --git a/PlexRequests.Store/UserRepository.cs b/PlexRequests.Store/UserRepository.cs index f921cff00..addc7366a 100644 --- a/PlexRequests.Store/UserRepository.cs +++ b/PlexRequests.Store/UserRepository.cs @@ -72,7 +72,7 @@ namespace PlexRequests.Store public T Get(int id) { - throw new NotImplementedException(); + throw new NotSupportedException("Get(int) is not supported. Use Get(string)"); } public void Delete(T entity) diff --git a/PlexRequests.UI/Modules/UserLoginModule.cs b/PlexRequests.UI/Modules/UserLoginModule.cs index b26447d3c..227f7778f 100644 --- a/PlexRequests.UI/Modules/UserLoginModule.cs +++ b/PlexRequests.UI/Modules/UserLoginModule.cs @@ -25,7 +25,10 @@ // ************************************************************************/ #endregion using Nancy; +using Nancy.Responses.Negotiation; +using PlexRequests.Core; +using PlexRequests.Core.SettingModels; using PlexRequests.UI.Models; namespace PlexRequests.UI.Modules @@ -37,12 +40,20 @@ namespace PlexRequests.UI.Modules // TODO: Allow the user of a username only or a Username and password public class UserLoginModule : NancyModule { - public UserLoginModule() : base("userlogin") + public UserLoginModule(ISettingsService auth) : base("userlogin") { - Get["/"] = _ => View["Index"]; + AuthService = auth; + Get["/"] = _ => Index(); Post["/"] = x => LoginUser(); } + public Negotiator Index() + { + var settings = AuthService.GetSettings(); + return View["Index", settings]; + } + private ISettingsService AuthService { get; set; } + private Response LoginUser() { var username = Request.Form.username; diff --git a/PlexRequests.sln b/PlexRequests.sln index a528f70e1..2bd22d2d1 100644 --- a/PlexRequests.sln +++ b/PlexRequests.sln @@ -15,6 +15,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PlexRequests.Store", "PlexR EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{F4BC839C-B8FF-48BE-B22E-536A0A0A81A5}" ProjectSection(SolutionItems) = preProject + .travis.yml = .travis.yml LICENSE = LICENSE README.md = README.md EndProjectSection