How to structure different login interfaces?

Hello, I can’t figure out how to structure different login interfaces. Client wants three interfaces: normal login form, login form via dropdown and login form via modal.

We’re using iron:router and would like to know if it is possible that /login can decide what template to render instead of assigning it by default this way?

Router.route('/login', {
 name: 'guest.login',
 action: function () {
 //rendering already done in onBeforeAction route hook
 }});

I’m thinking that putting in /login-dropdown, /login-modal is not the right way… Thanks for any suggestions/solutions. :slight_smile:

Sure thing - take a look at the waitOn example from the Iron Router Guide:

Router.route('/post/:_id', {
  // this template will be rendered until the subscriptions are ready
  loadingTemplate: 'loading',

  waitOn: function () {
    // return one handle, a function, or an array
    return Meteor.subscribe('post', this.params._id);
  },

  action: function () {
    this.render('myTemplate');
  }
});

Ignore the waitOn part for now, but see how the template is being set in the action method? You could use some conditional logic in the action method to decide which template to show.

1 Like

Thank you @hwillson. Your comment helped me get started with this task. :smile: