I need to do additional processing after the user is logged in.
I have created an action filter:
public IEnumerable<Filter> GetFilters(ControllerContext controllerContext, ActionDescriptor actionDescriptor)
{
if (actionDescriptor.ControllerDescriptor.ControllerType == typeof(Web.Controllers.CustomerController)
&& actionDescriptor.ActionName.Equals("Login")
&& controllerContext.HttpContext.Request.HttpMethod == "POST")
{
return new List<Filter>() { new Filter(this, FilterScope.Action, 0) };
}
return new List<Filter>();
}
public override void OnActionExecuted(ActionExecutedContext filterContext)
{
string username = filterContext.HttpContext.User.Identity.Name;
var workContext = EngineContext.Current.Resolve<IWorkContext>();
var customer = workContext.CurrentCustomer;
if (customer != null && !customer.IsGuest() && customer.IsRegistered())
{
}
base.OnActionExecuted(filterContext);
}
The code in the OnActionExecuted is my attempts to get the logged in user but so far it only returns the guest user.