mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-11 07:46:05 -07:00
More work for #298
This commit is contained in:
parent
0fa42b93f5
commit
05e4c313bf
7 changed files with 108 additions and 13 deletions
|
@ -28,9 +28,11 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using Nancy;
|
||||
using Nancy.Extensions;
|
||||
using Nancy.Responses;
|
||||
using Nancy.Responses.Negotiation;
|
||||
|
||||
using NLog;
|
||||
|
@ -46,23 +48,30 @@ namespace PlexRequests.UI.Modules
|
|||
{
|
||||
public class UserLoginModule : BaseModule
|
||||
{
|
||||
public UserLoginModule(ISettingsService<AuthenticationSettings> auth, IPlexApi api, ISettingsService<PlexRequestSettings> pr) : base("userlogin", pr)
|
||||
public UserLoginModule(ISettingsService<AuthenticationSettings> auth, IPlexApi api, ISettingsService<PlexRequestSettings> pr, ISettingsService<LandingPageSettings> lp) : base("userlogin", pr)
|
||||
{
|
||||
AuthService = auth;
|
||||
LandingPageSettings = lp;
|
||||
Api = api;
|
||||
Get["/"] = _ => Index();
|
||||
Get["/", true] = async (x, ct) => await Index();
|
||||
Post["/"] = x => LoginUser();
|
||||
Get["/logout"] = x => Logout();
|
||||
}
|
||||
|
||||
private ISettingsService<AuthenticationSettings> AuthService { get; }
|
||||
private ISettingsService<LandingPageSettings> LandingPageSettings { get; }
|
||||
private IPlexApi Api { get; }
|
||||
|
||||
private static Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
public Negotiator Index()
|
||||
public async Task<Negotiator> Index()
|
||||
{
|
||||
var settings = AuthService.GetSettings();
|
||||
var landingSettings = await LandingPageSettings.GetSettingsAsync();
|
||||
if (landingSettings.Enabled)
|
||||
{
|
||||
return View["Landing/Index",landingSettings];
|
||||
}
|
||||
var settings = await AuthService.GetSettingsAsync();
|
||||
return View["Index", settings];
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue