mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-08 06:00:50 -07:00
MOre work
This commit is contained in:
parent
65087642e1
commit
2f5db03815
7 changed files with 112 additions and 8 deletions
58
PlexRequests.UI/Modules/BaseModule.cs
Normal file
58
PlexRequests.UI/Modules/BaseModule.cs
Normal file
|
@ -0,0 +1,58 @@
|
|||
#region Copyright
|
||||
// /************************************************************************
|
||||
// Copyright (c) 2016 Jamie Rees
|
||||
// File: BaseModule.cs
|
||||
// Created By: Jamie Rees
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
// ************************************************************************/
|
||||
#endregion
|
||||
|
||||
using Nancy;
|
||||
using Nancy.Extensions;
|
||||
using PlexRequests.UI.Models;
|
||||
|
||||
namespace PlexRequests.UI.Modules
|
||||
{
|
||||
public class BaseModule : NancyModule
|
||||
{
|
||||
// TODO get this working
|
||||
public BaseModule()
|
||||
{
|
||||
//CheckAuth();
|
||||
}
|
||||
|
||||
public BaseModule(string modulePath) : base(modulePath)
|
||||
{
|
||||
//CheckAuth();
|
||||
}
|
||||
|
||||
|
||||
private void CheckAuth()
|
||||
{
|
||||
|
||||
if (Request?.Session?[SessionKeys.UsernameKey] == null)
|
||||
{
|
||||
Context.GetRedirect("~/userlogin");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -41,7 +41,7 @@ using PlexRequests.UI.Models;
|
|||
|
||||
namespace PlexRequests.UI.Modules
|
||||
{
|
||||
public class SearchModule : NancyModule
|
||||
public class SearchModule : BaseModule
|
||||
{
|
||||
public SearchModule(ICacheProvider cache, ISettingsService<CouchPotatoSettings> cpSettings) : base("search")
|
||||
{
|
||||
|
|
|
@ -61,7 +61,7 @@ namespace PlexRequests.UI.Modules
|
|||
// Add to the session
|
||||
Request.Session[SessionKeys.UsernameKey] = username;
|
||||
|
||||
return Response.AsJson("");
|
||||
return Response.AsJson(new { Result = true });
|
||||
}
|
||||
}
|
||||
}
|
|
@ -146,6 +146,7 @@
|
|||
<Compile Include="Models\SearchTvShowViewModel.cs" />
|
||||
<Compile Include="Models\SessionKeys.cs" />
|
||||
<Compile Include="Modules\AdminModule.cs" />
|
||||
<Compile Include="Modules\BaseModule.cs" />
|
||||
<Compile Include="Modules\IndexModule.cs" />
|
||||
<Compile Include="Modules\UserLoginModule.cs" />
|
||||
<Compile Include="Modules\LoginModule.cs" />
|
||||
|
|
|
@ -17,3 +17,4 @@ If you have not yet created an Admin account you can do here: <a href="/register
|
|||
Invalid Username or Password!
|
||||
</div>
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,44 @@
|
|||
<form method="POST">
|
||||
Username <input class="form-control" type="text" name="Username"/>
|
||||
<form method="POST" id="loginForm">
|
||||
<label>
|
||||
Username</label> <input class="form-control" type="text" name="Username"/>
|
||||
<br/>
|
||||
Password <input class="form-control" name="Password" type="password"/>
|
||||
@if (Model.UsePassword)
|
||||
{
|
||||
<label> Password </label>
|
||||
<input class="form-control" name="Password" type="password"/>
|
||||
}
|
||||
<br/>
|
||||
<input class="btn btn-success" type="submit" value="Login"/>
|
||||
<input id="loginBtn" class="btn btn-success" type="submit" value="Login"/>
|
||||
</form>
|
||||
|
||||
|
||||
<script>
|
||||
$(function() {
|
||||
|
||||
$('#loginBtn').click(function (e) {
|
||||
e.preventDefault();
|
||||
var $form = $("#loginForm");
|
||||
$.ajax({
|
||||
type: $form.prop("method"),
|
||||
url: $form.prop("action"),
|
||||
data: $form.serialize(),
|
||||
dataType: "json",
|
||||
success: function (response) {
|
||||
console.log(response);
|
||||
if (response.result === true) {
|
||||
window.location.replace("/search");
|
||||
} else {
|
||||
generateNotify(response.message, "warning");
|
||||
}
|
||||
},
|
||||
error: function (e) {
|
||||
console.log(e);
|
||||
generateNotify("Something went wrong!", "danger");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
});
|
||||
</script>
|
|
@ -29,6 +29,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PlexRequests.Core.Tests", "
|
|||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PlexRequests.Helpers.Tests", "PlexRequests.Helpers.Tests\PlexRequests.Helpers.Tests.csproj", "{0E6395D3-B074-49E8-898D-0EB99E507E0E}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{EC46BEB4-AEC4-42AE-B1D5-6B32FEA8154A}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
|
@ -75,4 +77,9 @@ Global
|
|||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{A930E2CF-79E2-45F9-B06A-9A719A254CE4} = {EC46BEB4-AEC4-42AE-B1D5-6B32FEA8154A}
|
||||
{FCFECD5D-47F6-454D-8692-E27A921BE655} = {EC46BEB4-AEC4-42AE-B1D5-6B32FEA8154A}
|
||||
{0E6395D3-B074-49E8-898D-0EB99E507E0E} = {EC46BEB4-AEC4-42AE-B1D5-6B32FEA8154A}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue