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:
Drewster727 2016-03-30 11:06:35 -05:00
parent a028a68a08
commit a668ea04ec
4 changed files with 29 additions and 15 deletions

View file

@ -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()
{