Prevent a user creation

Topics: General
Aug 17, 2015 at 3:14 PM
Hi everyone,

I need to prevent a user creation (based on a condition), but I can't find the way to do that properly.

What I have achieved so far is to inherit from ContentHandler and implement a method on the OnCreated event, then use ContentManager to delete the user that is currently in creation process. The problem is that a notification appears saying "User created".

I also tried to inherit from IUserEventHandler and set context.Cancel to null in the Creating() method. The problem is that the Orchard.Users module throws a NullReference exception when doing so.

Can anyone point me in the right direction?

Thanks a lot for your help.