mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-11 15:56:05 -07:00
parent
698356d55e
commit
e17bd94990
3 changed files with 52 additions and 47 deletions
|
@ -69,6 +69,48 @@ namespace Ombi.UI.Modules
|
||||||
CustomUserMapper = custom;
|
CustomUserMapper = custom;
|
||||||
UserManagementSettings = userManagementSettings;
|
UserManagementSettings = userManagementSettings;
|
||||||
|
|
||||||
|
//Get["UserLoginIndex", "/", true] = async (x, ct) =>
|
||||||
|
//{
|
||||||
|
// if (Request.Query["landing"] == null)
|
||||||
|
// {
|
||||||
|
// var s = await LandingPageSettings.GetSettingsAsync();
|
||||||
|
// if (s.Enabled)
|
||||||
|
// {
|
||||||
|
// if (s.BeforeLogin) // Before login
|
||||||
|
// {
|
||||||
|
// if (string.IsNullOrEmpty(Username))
|
||||||
|
// {
|
||||||
|
// // They are not logged in
|
||||||
|
// return
|
||||||
|
// Context.GetRedirect(Linker.BuildRelativeUri(Context, "LandingPageIndex").ToString());
|
||||||
|
// }
|
||||||
|
// return Context.GetRedirect(Linker.BuildRelativeUri(Context, "SearchIndex").ToString());
|
||||||
|
// }
|
||||||
|
|
||||||
|
// // After login
|
||||||
|
// if (string.IsNullOrEmpty(Username))
|
||||||
|
// {
|
||||||
|
// // Not logged in yet
|
||||||
|
// return Context.GetRedirect(Linker.BuildRelativeUri(Context, "UserLoginIndex").ToString() + "?landing");
|
||||||
|
// }
|
||||||
|
// // Send them to landing
|
||||||
|
// var landingUrl = Linker.BuildRelativeUri(Context, "LandingPageIndex").ToString();
|
||||||
|
// return Context.GetRedirect(landingUrl);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// if (!string.IsNullOrEmpty(Username) || IsAdmin)
|
||||||
|
// {
|
||||||
|
// var url = Linker.BuildRelativeUri(Context, "SearchIndex").ToString();
|
||||||
|
// return Response.AsRedirect(url);
|
||||||
|
// }
|
||||||
|
// var settings = await AuthService.GetSettingsAsync();
|
||||||
|
// return View["Index", settings];
|
||||||
|
//};
|
||||||
|
|
||||||
|
Post["/", true] = async (x, ct) => await LoginUser();
|
||||||
|
Get["/logout"] = x => Logout();
|
||||||
|
|
||||||
Get["UserLoginIndex", "/", true] = async (x, ct) =>
|
Get["UserLoginIndex", "/", true] = async (x, ct) =>
|
||||||
{
|
{
|
||||||
if (Request.Query["landing"] == null)
|
if (Request.Query["landing"] == null)
|
||||||
|
@ -99,48 +141,6 @@ namespace Ombi.UI.Modules
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(Username) || IsAdmin)
|
|
||||||
{
|
|
||||||
var url = Linker.BuildRelativeUri(Context, "SearchIndex").ToString();
|
|
||||||
return Response.AsRedirect(url);
|
|
||||||
}
|
|
||||||
var settings = await AuthService.GetSettingsAsync();
|
|
||||||
return View["Index", settings];
|
|
||||||
};
|
|
||||||
|
|
||||||
Post["/", true] = async (x, ct) => await LoginUser();
|
|
||||||
Get["/logout"] = x => Logout();
|
|
||||||
|
|
||||||
Get["UserLoginUsernameIndex", "/login", true] = async (x, ct) =>
|
|
||||||
{
|
|
||||||
if (Request.Query["landing"] == null)
|
|
||||||
{
|
|
||||||
var s = await LandingPageSettings.GetSettingsAsync();
|
|
||||||
if (s.Enabled)
|
|
||||||
{
|
|
||||||
if (s.BeforeLogin) // Before login
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(Username))
|
|
||||||
{
|
|
||||||
// They are not logged in
|
|
||||||
return
|
|
||||||
Context.GetRedirect(Linker.BuildRelativeUri(Context, "LandingPageIndex").ToString());
|
|
||||||
}
|
|
||||||
return Context.GetRedirect(Linker.BuildRelativeUri(Context, "SearchIndex").ToString());
|
|
||||||
}
|
|
||||||
|
|
||||||
// After login
|
|
||||||
if (string.IsNullOrEmpty(Username))
|
|
||||||
{
|
|
||||||
// Not logged in yet
|
|
||||||
return Context.GetRedirect(Linker.BuildRelativeUri(Context, "UserLoginUsernameIndex").ToString() + "?landing");
|
|
||||||
}
|
|
||||||
// Send them to landing
|
|
||||||
var landingUrl = Linker.BuildRelativeUri(Context, "LandingPageIndex").ToString();
|
|
||||||
return Context.GetRedirect(landingUrl);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(Username) || IsAdmin)
|
if (!string.IsNullOrEmpty(Username) || IsAdmin)
|
||||||
{
|
{
|
||||||
var url = Linker.BuildRelativeUri(Context, "SearchIndex").ToString();
|
var url = Linker.BuildRelativeUri(Context, "SearchIndex").ToString();
|
||||||
|
@ -215,7 +215,7 @@ namespace Ombi.UI.Modules
|
||||||
authenticated = true;
|
authenticated = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (settings.UsePassword || isOwner)
|
if (settings.UsePassword || isOwner || Security.HasPermissions(username, Permissions.Administrator))
|
||||||
{
|
{
|
||||||
Session[SessionKeys.UserLoginName] = username;
|
Session[SessionKeys.UserLoginName] = username;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
<form method="POST" id="passwordForm">
|
<form method="POST" id="passwordForm">
|
||||||
<input id="dateTimeOffset" name="DateTimeOffset" hidden="hidden" />
|
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<div>
|
<div>
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
<button id="loginBtn" class="btn btn-success-outline" type="submit"><i class="fa fa-user fa-fw"></i> @UI.UserLogin_SignIn</button>
|
<button id="loginBtn" class="btn btn-success-outline" type="submit"><i class="fa fa-user fa-fw"></i> @UI.UserLogin_SignIn</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
<div id="contentBody2"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
@ -49,7 +50,7 @@
|
||||||
|
|
||||||
return $('#dateTimeOffset').val(new Date().getTimezoneOffset());
|
return $('#dateTimeOffset').val(new Date().getTimezoneOffset());
|
||||||
} else {
|
} else {
|
||||||
return window.location.replace(response.url);
|
return window.location.replace(response.url); // This is probably not uses, it probably goes into the error callback
|
||||||
}
|
}
|
||||||
} else if (response.responseText) {
|
} else if (response.responseText) {
|
||||||
return $('#htmlId').html(response.responseText);
|
return $('#htmlId').html(response.responseText);
|
||||||
|
@ -71,7 +72,7 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
$('#contentBody').on('click', '#passwordBtn', function (e) {
|
$('#contentBody, #contentBody2').on('click', '#passwordBtn', function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
var url = createBaseUrl(base, '/userlogin/password');
|
var url = createBaseUrl(base, '/userlogin/password');
|
||||||
|
@ -103,8 +104,13 @@
|
||||||
|
|
||||||
function loadArea(html) {
|
function loadArea(html) {
|
||||||
var $body = $('#contentBody');
|
var $body = $('#contentBody');
|
||||||
|
var $body2 = $('#contentBody2');
|
||||||
|
$body2.slideUp();
|
||||||
// Do some sliding?
|
// Do some sliding?
|
||||||
$body.html(html);
|
$body.fadeOut();
|
||||||
|
$body2.html(html);
|
||||||
|
$body2.fadeIn();
|
||||||
|
$body.html("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue