mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-11 07:46:05 -07:00
Fixed the issue with user management, needed to implement our own authentication provider
This commit is contained in:
parent
63c2744336
commit
2a8927eb6d
46 changed files with 1132 additions and 565 deletions
|
@ -31,7 +31,6 @@ using System;
|
|||
using System.Dynamic;
|
||||
using System.Security;
|
||||
using Nancy;
|
||||
using Nancy.Authentication.Forms;
|
||||
using Nancy.Extensions;
|
||||
using Nancy.Linker;
|
||||
using Nancy.Responses.Negotiation;
|
||||
|
@ -43,14 +42,17 @@ using PlexRequests.Helpers;
|
|||
using PlexRequests.Helpers.Permissions;
|
||||
using PlexRequests.Store;
|
||||
using PlexRequests.Store.Repository;
|
||||
using PlexRequests.UI.Authentication;
|
||||
using PlexRequests.UI.Helpers;
|
||||
using PlexRequests.UI.Models;
|
||||
using ModuleExtensions = Nancy.Authentication.Forms.ModuleExtensions;
|
||||
|
||||
namespace PlexRequests.UI.Modules
|
||||
{
|
||||
public class LoginModule : BaseModule
|
||||
{
|
||||
public LoginModule(ISettingsService<PlexRequestSettings> pr, ICustomUserMapper m, IResourceLinker linker, IRepository<UserLogins> userLoginRepo)
|
||||
: base(pr)
|
||||
public LoginModule(ISettingsService<PlexRequestSettings> pr, ICustomUserMapper m, IResourceLinker linker, IRepository<UserLogins> userLoginRepo, ISecurityExtensions security)
|
||||
: base(pr, security)
|
||||
{
|
||||
UserMapper = m;
|
||||
Get["LocalLogin","/login"] = _ =>
|
||||
|
@ -74,7 +76,7 @@ namespace PlexRequests.UI.Modules
|
|||
{
|
||||
Session.Delete(SessionKeys.UsernameKey);
|
||||
}
|
||||
return this.LogoutAndRedirect(!string.IsNullOrEmpty(BaseUrl) ? $"~/{BaseUrl}/" : "~/");
|
||||
return CustomModuleExtensions.LogoutAndRedirect(this, !string.IsNullOrEmpty(BaseUrl) ? $"~/{BaseUrl}/" : "~/");
|
||||
};
|
||||
|
||||
Post["/login"] = x =>
|
||||
|
@ -112,7 +114,7 @@ namespace PlexRequests.UI.Modules
|
|||
UserId = userId.ToString()
|
||||
});
|
||||
|
||||
return this.LoginAndRedirect(userId.Value, expiry, redirect);
|
||||
return CustomModuleExtensions.LoginAndRedirect(this,userId.Value, expiry, redirect);
|
||||
};
|
||||
|
||||
Get["/register"] = x =>
|
||||
|
@ -138,7 +140,7 @@ namespace PlexRequests.UI.Modules
|
|||
}
|
||||
var userId = UserMapper.CreateUser(username, Request.Form.Password, EnumHelper<Permissions>.All(), 0);
|
||||
Session[SessionKeys.UsernameKey] = username;
|
||||
return this.LoginAndRedirect((Guid)userId);
|
||||
return CustomModuleExtensions.LoginAndRedirect(this, (Guid)userId);
|
||||
};
|
||||
|
||||
Get["/changepassword"] = _ => ChangePassword();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue