mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-11 07:46:05 -07:00
styling for #298 done, just need to wire up the model and do the actual status check
This commit is contained in:
parent
9f74d31f1d
commit
46f7a0769e
14 changed files with 180 additions and 23 deletions
|
@ -71,9 +71,25 @@ namespace PlexRequests.UI.Modules
|
|||
if (landingCheck)
|
||||
{
|
||||
var landingSettings = await LandingPageSettings.GetSettingsAsync();
|
||||
|
||||
if (landingSettings.Enabled)
|
||||
{
|
||||
return View["Landing/Index", landingSettings];
|
||||
if (landingSettings.BeforeLogin)
|
||||
{
|
||||
var model = new LandingPageViewModel
|
||||
{
|
||||
Enabled = landingSettings.Enabled,
|
||||
Id = landingSettings.Id,
|
||||
EnabledNoticeTime = landingSettings.EnabledNoticeTime,
|
||||
NoticeEnable = landingSettings.NoticeEnable,
|
||||
NoticeEnd = landingSettings.NoticeEnd,
|
||||
NoticeMessage = landingSettings.NoticeMessage,
|
||||
NoticeStart = landingSettings.NoticeStart,
|
||||
ContinueUrl = landingSettings.BeforeLogin ? $"userlogin" : $"search"
|
||||
};
|
||||
|
||||
return View["Landing/Index", model];
|
||||
}
|
||||
}
|
||||
}
|
||||
var settings = await AuthService.GetSettingsAsync();
|
||||
|
@ -84,7 +100,7 @@ namespace PlexRequests.UI.Modules
|
|||
{
|
||||
var dateTimeOffset = Request.Form.DateTimeOffset;
|
||||
var username = Request.Form.username.Value;
|
||||
Log.Debug("Username \"{0}\" attempting to login",username);
|
||||
Log.Debug("Username \"{0}\" attempting to login", username);
|
||||
if (string.IsNullOrWhiteSpace(username))
|
||||
{
|
||||
return Response.AsJson(new JsonResponseModel { Result = false, Message = "Incorrect User or Password" });
|
||||
|
@ -107,7 +123,7 @@ namespace PlexRequests.UI.Modules
|
|||
password = Request.Form.password.Value;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (settings.UserAuthentication && settings.UsePassword) // Authenticate with Plex
|
||||
{
|
||||
Log.Debug("Need to auth and also provide pass");
|
||||
|
@ -127,7 +143,7 @@ namespace PlexRequests.UI.Modules
|
|||
}
|
||||
}
|
||||
}
|
||||
else if(settings.UserAuthentication) // Check against the users in Plex
|
||||
else if (settings.UserAuthentication) // Check against the users in Plex
|
||||
{
|
||||
Log.Debug("Need to auth");
|
||||
authenticated = CheckIfUserIsInPlexFriends(username, settings.PlexAuthToken);
|
||||
|
@ -138,7 +154,7 @@ namespace PlexRequests.UI.Modules
|
|||
}
|
||||
Log.Debug("Friends list result = {0}", authenticated);
|
||||
}
|
||||
else if(!settings.UserAuthentication) // No auth, let them pass!
|
||||
else if (!settings.UserAuthentication) // No auth, let them pass!
|
||||
{
|
||||
Log.Debug("No need to auth");
|
||||
authenticated = true;
|
||||
|
@ -153,12 +169,22 @@ namespace PlexRequests.UI.Modules
|
|||
|
||||
Session[SessionKeys.ClientDateTimeOffsetKey] = (int)dateTimeOffset;
|
||||
|
||||
return Response.AsJson(authenticated
|
||||
? new JsonResponseModel { Result = true }
|
||||
: new JsonResponseModel { Result = false, Message = "Incorrect User or Password"});
|
||||
if (!authenticated)
|
||||
{
|
||||
return Response.AsJson(new JsonResponseModel {Result = false, Message = "Incorrect User or Password"});
|
||||
}
|
||||
|
||||
var landingSettings = LandingPageSettings.GetSettings();
|
||||
|
||||
if (landingSettings.Enabled)
|
||||
{
|
||||
if (!landingSettings.BeforeLogin)
|
||||
return Response.AsJson(new JsonResponseModel { Result = true, Message = "landing" });
|
||||
}
|
||||
return Response.AsJson(new JsonResponseModel {Result = true, Message = "search" });
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private Response Logout()
|
||||
{
|
||||
|
@ -167,8 +193,8 @@ namespace PlexRequests.UI.Modules
|
|||
{
|
||||
Session.Delete(SessionKeys.UsernameKey);
|
||||
}
|
||||
return Context.GetRedirect(!string.IsNullOrEmpty(BaseUrl)
|
||||
? $"~/{BaseUrl}/userlogin"
|
||||
return Context.GetRedirect(!string.IsNullOrEmpty(BaseUrl)
|
||||
? $"~/{BaseUrl}/userlogin"
|
||||
: "~/userlogin");
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue