This project is read-only.

Customizing orchard registration page to force email address as username

Topics: Customizing Orchard
Aug 18, 2015 at 9:45 AM
For a site we're building, we'd like to prompt registering users for only an email address and password - no user name. The user name will always be the email address. This is surely something that others have already implemented. What do you suggest as the best way to do this?
Aug 21, 2015 at 11:09 PM
Two ways:
  1. With code: when writing your own module, you can create a custom controller and route provider, which overrides the route from the Users module so that the same URL is used, but your controller will handle it instead. This way you get complete control over the UI as well as handling the form submission. Looking at the Users module will reveal what you need to do to actually create the registering user.
  2. Without code: with Dynamic Forms you can create your own forms and use Workflows to handle their submission. With Workflows you can use the CreateUser activity and other activities to create users based on form input and assign roles. I actually wrote a blog post about this (unfortunately the post lost its imagery, so it will be hard to read, but may give some clues still):
Aug 31, 2015 at 1:36 PM
I was hoping there was a simpler solution for this (likely?) common customization that I was missing. But creating a custom controller to replace the standard routes isn't so bad. I suppose we could create a module for this and upload it to the gallery. The Dynamic Forms approach is another interesting option. I hadn't thought of that.

Thanks for the quick response, very helpful!