Undo User Registration - Plugin

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
4 years ago
Hello,
I'm using nopcommerce 4.20.
I create a plugin that is connecting to a 3rd app (and sending additional data), upon user registration event
 public void HandleEvent(CustomerRegisteredEvent eventMessage)

(its name, email etc)
If there wosn't any connection or 3rd app returned error( wrong data), i want to undo the registration.
It is possible to make it via plugin ? or its neccesary to change the framework code !

Thank you.
4 years ago
Make customer deleted(soft delete).

public class OrderUpdateEventConsumer : IConsumer<CustomerRegisteredEvent>
    {
        private readonly ICustomerService _customerService=EngineContext.Current.Resolve<ICustomerService>();

  public void HandleEvent(CustomerRegisteredEvent eventMessage)
        {
            eventMessage.Customer.Deleted = true;
            _customerService.UpdateCustomer(eventMessage.Customer);
}
}
4 years ago
Please delete this customer hard delete using code because if u make this customer as soft delete then next time same customer cant be able to register again. so my advice to hard delete customer.
4 years ago
chauhanmit22 wrote:
Hello,

Only difficulty I see here is that communication might have already been sent to the user about registration (welcome email). So user would be confused if registration succeeded why he is not able to login. Very bad user experience.

Also, it would be unwise to stop or delete queued email. You might not be sure if email was already sent. Or you need to send user a subsequent email about your registration has been revoked.

I would suggest to write a ActionFilter and do the post to API at that while action being performed. If it hits any obstacle, simply send to registration failure page. This would prevent the registration.

Regards,

Thanks! i was thiking about ActionFilter too, can u sugest some implementation , or where to look !
Something like this https://www.pronopcommerce.com/overriding-intercepting-nopcommerce-controllers-and-actions i guess ?
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.