Orchard: user registration fields

For my Orchard project, I need additional information from the user during registration. (Say first name, last name, color of trousers). This information must be entered at the time of registration and cannot be delayed until a later time (according to customer orders).

I tried to use the profile and advanced registration plugins to ask them, but as far as I can see, this gives me additional fields to display in the registration form. Is there a way to present required fields?

I also had a quick raid on overwriting the AccountController method Register, according to this discussion , but I could not get it work: The controller is in another place, it cannot be subclassed, and even if I force it, the code never executes. I suppose they use a much older version of Orchard.

So, in what direction should I go in order to create a mandatory field that is close to Orchard's philosophy? Should I create a new field type that can reject null values? (is it possible)?

+5
source share
2 answers

ExtendedRegistration - . , : MyRegistrationPart. User ContentType. [] ( ) , . , !

, .

+6

, , , , , / AccountController. "" Users/Account/Register, . IRouteProvider . , . - :

public class Routes : IRouteProvider
{
    public void GetRoutes(ICollection<RouteDescriptor> routes)
    {
        routes.AddRange(GetRoutes());
    }

    public IEnumerable<RouteDescriptor> GetRoutes()
    {
        return new[] {
            new RouteDescriptor {
                // Make sure to be higher than the default
                Priority = ##### PRIORITY HERE (int) ######,
                Route = new Route(
                "Users/Account/Register",
                new RouteValueDictionary {
                    {"area", "#### YOUR MODULE AREA HERE ####"},
                    {"controller", "#### YOUR ACCOUNT CONTROLLER HERE ####"},
                    {"action", "#### YOUR REGISTER ACTION HERE ####"}
                },
                new RouteValueDictionary(),
                new RouteValueDictionary {
                    {"area", "#### YOUR MODULE AREA HERE ####"}
                },
                new MvcRouteHandler())
            }
        };
    }
}
+3

All Articles