Topics: Administration, Core, Customizing Orchard, Writing modules
Nov 5, 2013 at 8:48 PM
I'm implementing an Orchard site for our company's Intranet. I think the security will work as is for the most part. I plan on creating a process to dump all of our current registered employees into the user store in Orchard.

But the one caveat is, our registration process requires some additional information. Our business rules require us to use our employee ids as our usernames but we also must provide our SSN, zip code and birthdate. We run all this info against the employee's info in our legacy db and if it checks out, we register them on our site.

So basically, I need to add the three additional fields to the registration process, and then verify all the information in the back-end. So my question would be, should I create something entirely new / custom, or should I modify Orchard.Users module to do what I need?
Nov 5, 2013 at 11:19 PM
Can you not just attach a part with your 3 new fields to the User content type?
Nov 6, 2013 at 12:51 PM
Well, I didn't want to store that info. It was more for just validating someone is who they say they are upon registering.
Nov 6, 2013 at 3:06 PM
Edited Nov 6, 2013 at 3:06 PM
Oh sorry, I failed to read properly last night. There are a couple of things you can do.

I'd probably hook into the Creating user event and there you should be able to validate users inputs. So you would want to create a class like:
public class ValidateUser : IUserEventHandler {
  public void Created(UserContext context) {
    // Do your business
UserContext has a property called that you can set to Cancel that, I assume, would cancel user creation. Never tried it though ^_^

Else you could override the MembershipService itself and insert your own shizzle with OrchardSuppressDependency
public class MyMembershipService : IMembershipService {
Or I guess you could just inherit from the IMembershipService and give your module a higher priority than users so it would just use yours.

Lots of options that should suit your purpose without having to edit Orchards core.
Nov 6, 2013 at 4:00 PM
If registration is goint to happen only through a registration form on the site, you can create your own controller and render a form with your additional fields, do the verification on post and call membership or user service methods to create the user. You can provide the routing rules with higher priority to suppress the default registration controller registration action by Users module.