|
|
@ -27,6 +27,7 @@
|
|
|
|
using System.Linq;
|
|
|
|
using System.Linq;
|
|
|
|
|
|
|
|
|
|
|
|
using Nancy;
|
|
|
|
using Nancy;
|
|
|
|
|
|
|
|
using Nancy.Extensions;
|
|
|
|
using Nancy.Responses.Negotiation;
|
|
|
|
using Nancy.Responses.Negotiation;
|
|
|
|
|
|
|
|
|
|
|
|
using PlexRequests.Api.Interfaces;
|
|
|
|
using PlexRequests.Api.Interfaces;
|
|
|
@ -46,6 +47,7 @@ namespace PlexRequests.UI.Modules
|
|
|
|
Api = api;
|
|
|
|
Api = api;
|
|
|
|
Get["/"] = _ => Index();
|
|
|
|
Get["/"] = _ => Index();
|
|
|
|
Post["/"] = x => LoginUser();
|
|
|
|
Post["/"] = x => LoginUser();
|
|
|
|
|
|
|
|
Get["/logout"] = x => Logout();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private ISettingsService<AuthenticationSettings> AuthService { get; }
|
|
|
|
private ISettingsService<AuthenticationSettings> AuthService { get; }
|
|
|
@ -104,6 +106,15 @@ namespace PlexRequests.UI.Modules
|
|
|
|
: new JsonResponseModel { Result = false, Message = "Incorrect User or Password"});
|
|
|
|
: new JsonResponseModel { Result = false, Message = "Incorrect User or Password"});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private Response Logout()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (Session[SessionKeys.UsernameKey] != null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Session.Delete(SessionKeys.UsernameKey);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return Context.GetRedirect("~/userlogin");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private bool CheckIfUserIsInPlexFriends(string username, string authToken)
|
|
|
|
private bool CheckIfUserIsInPlexFriends(string username, string authToken)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var users = Api.GetUsers(authToken);
|
|
|
|
var users = Api.GetUsers(authToken);
|
|
|
|