How do I create different registration pages for groups in express-stormpath

93 views Asked by At

I am looking to create different registration pages for different groups in express-stormpath. For example:

router.get('/new', stormpath.groupsRequired(['Merchants']), function(req, res){
//this would render a signup for merchants if a merchant wasn't signed in
});

router.get('/new', stormpath.groupsRequired(['customers']), function(req, res){
//this would render a signup for customer if a customer wasn't signed in
});

I have read through the docs but haven't had any luck, how do I do this?

1

There are 1 answers

2
rdegges On

There's not a native way to render registration screens for different 'groups' of users.

You do have a few options though:

  1. Create your own registration views / routes for each of your Group types. Assign them routes like /register/merchants, /register/customers, etc.

You can then use the route parameters in Express to parse out the part after the URL, and use that to assign the user into that group after you've created them.

  1. The other option is to keep it really simple. Just use the normal /register/ route that express-stormpath provides, and customize the view template yourself. When people land on the registration page, show them a template that has a dropdown for what type of person they are (merchant? customer? etc?) and let them pick.

Either way shouldn't be difficult. If you have specific questions, you can always hit me up directly.

SOURCE: I'm the original author of this library, and work at the company which maintains it =)