mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-08 06:00:50 -07:00
don't query the session as much in the modules, rely on a variable from the base class and store the username as needed
This commit is contained in:
parent
a028a68a08
commit
a668ea04ec
4 changed files with 29 additions and 15 deletions
|
@ -33,16 +33,30 @@ namespace PlexRequests.UI.Modules
|
|||
{
|
||||
public class BaseModule : NancyModule
|
||||
{
|
||||
private string _username;
|
||||
|
||||
protected string Username
|
||||
{
|
||||
get
|
||||
{
|
||||
if (string.IsNullOrEmpty(_username))
|
||||
{
|
||||
_username = Session[SessionKeys.UsernameKey].ToString();
|
||||
}
|
||||
return _username;
|
||||
}
|
||||
}
|
||||
|
||||
public BaseModule()
|
||||
{
|
||||
Before += (ctx)=> CheckAuth();
|
||||
Before += (ctx) => CheckAuth();
|
||||
}
|
||||
|
||||
public BaseModule(string modulePath) : base(modulePath)
|
||||
{
|
||||
Before += (ctx) => CheckAuth();
|
||||
}
|
||||
|
||||
|
||||
|
||||
private Response CheckAuth()
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue