Overriding Register and My Account

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
7 years ago
Unless I am missing anything, I don't find any problem with the code.

So you did a breakpoint and it shows that CurrentCustomer is another customer?
7 years ago
Yes, it always returns what I assume is a guest account. It certainly isn't returning the logged in user details.
7 years ago
davidwaller wrote:
Yes, it always returns what I assume is a guest account. It certainly isn't returning the logged in user details.

I suspect the work context won't be updated with the logged in customer until the login action issues the redirect to the next page and the authentication cookie is read as part of that request.

If you want to execute some code on login you might be better off creating a plugin that consumes the CustomerLoggedInEvent that is published after a successful login. See this post for more on how to consume an event from a plugin by implementing the IConsumer interface. The advantage of doing it this way is that the logged in customer object is going to be passed to the HandleEvent method of the event consumer.
7 years ago
petemitch wrote:
Yes, it always returns what I assume is a guest account. It certainly isn't returning the logged in user details.
I suspect the work context won't be updated with the logged in customer until the login action issues the redirect to the next page and the authentication cookie is read as part of that request.

If you want to execute some code on login you might be better off creating a plugin that consumes the CustomerLoggedInEvent that is published after a successful login. See this post for more on how to consume an event from a plugin by implementing the IConsumer interface. The advantage of doing it this way is that the logged in customer object is going to be passed to the HandleEvent method of the event consumer.


Thank you. I'll look at that now and post back my findings.
7 years ago
I have this code but events aren't being handled...

    
public class MyPlugin : BasePlugin, IConsumer<CustomerLoggedinEvent>
    {

        public void HandleEvent(CustomerLoggedinEvent eventMessage)
        {
            throw new NotImplementedException();
        }
    }


I suspect I'm failing to grasp some fundamental principles.
7 years ago
public class MyPlugin : BasePlugin, IConsumer<CustomerLoggedinEvent>
    {

        public void HandleEvent(CustomerLoggedinEvent eventMessage)
        {
            throw new NotImplementedException();
        }
    }


This works perfectly well, the exception is caught. Now to write some code.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.