javascript - Create login/signup page before routing to main page in Meteor? -


i have global route uses layout.html specifies header.html. know how to:

1) have main landing page login/sign proper formatting, without header. (im using useraccounts atmosphere formatting different, not sure why). header in layout.js cannot removed.

2) upon login/sign in, should go main page.

can advise how ?

router.configure({       layouttemplate: 'layout', //this header specified globally       waiton: function() {          return [meteor.subscribe('notifications')]       }     });  router.route('/', {   name: 'auth' }); //added new line  router.route('/posts', {   name: 'home',   controller: newpostscontroller });  var requirelogin = function() {   if (! meteor.user()) {     if (meteor.loggingin()) {       this.render(this.loadingtemplate);     } else {       this.render('accessdenied');     }   } else {     this.next();   } }  router.onbeforeaction('datanotfound', {only: 'postpage'}); router.onbeforeaction(requirelogin, {only: 'postsubmit'}); 


this layout.html defined globally.

<template name="layout">   <div class="container">     {{> header}}     {{> errors}}      <div id="main">       {{> yield}}     </div>   </div> </template> 

update after @chase's suggestion. - works on routing , header gone. - formatting different website though.

what have shown below while supposed http://useraccounts.meteor.com/ enter image description here

using set won't need set layout header every route.

the user accounts package has iron router plugin ensure user signed in use (more info). configure routes supplied user accounts package (more info) can directly route user accounts sign page.

javascript

router.configure({     layouttemplate: 'layout' //main layout header });  //iron router plugin ensure user signed in accountstemplates.configureroute('ensuresignedin', {     template: 'attemplate', //template shown if user not signed in     layouttemplate: 'atlayout' //template login, registration, etc });  //don't require user logged in these routes router.plugin('ensuresignedin', {     except: ['login', 'register'] });  //configure route login accountstemplates.configureroute('signin', {     name: 'login',     path: '/login',     template: 'attemplate',     layouttemplate: 'atlayout',     redirect: '/' });  //configure route registration accountstemplates.configureroute('signup', {     name: 'register',     path: '/register',     template: 'attemplate',     layouttemplate: 'atlayout',     redirect: '/' });  //home page show once logged in router.route('/', {     name: 'home',     action: function(){         this.render('home');     } }); 

html

<template name="layout">     <div class="container">         {{> header}}         {{> errors}}          <div id="main">             {{> yield}}         </div>     </div> </template>  <template name="atlayout">     <div class="at-container">         {{> yield}}     </div> </template>  <template name="attemplate">     {{> atform}} </template> 

Comments

Popular posts from this blog

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - UML - How would you draw a try catch in a sequence diagram? -

c++ - No viable overloaded operator for references a map -