title: Expressjs how to show / hide a div in case user its logged
body: <p>I followed this example -> <a href="https://github.com/visionmedia/express/tree/master/examples/auth" rel="nofollow">https://github.com/visionmedia/express/tree/master/examples/auth</a></p>
  
  <p>Works fine, but I dont like the way they display the content one time you successfully logged in or logged  out.</p>
  
  <p>Its there other way to do X or Y one time user its authenticated ? Example</p>
  
  <p>I have a linear form for login, will be nice to hide that div one time user it's authenticated, but I can't do this</p>
  
  <pre><code>$(document).ready(function(){
    if(req.session.user) { $(.class of teh frm to hide).hide(); }
  }
  </code></pre>
  
  <p>I tried too 
      session.user</p>
  
  <p>All the time tells me its undefined. I placed this on layout.</p>
  
  <p>So how I show things on a view if user its authenticated or, if user it's admin ??</p>
  
  <p>Cause atm the only way I see it's authorizate some routes and display specific content via </p>
  
  <pre><code>req.session.success = 'Authenticated as ' + req.session.user.name
    + ' click to &lt;a href="/logout"&gt;logout&lt;/a&gt;. '
    + ' You may now access &lt;a href="/restricted"&gt;/restricted&lt;/a&gt;.';
  } 
  </code></pre>
  
  <p>Think its not the way to go.</p>