title: How to dynamically check logged-in state from View in web2py
body: <p>I need to check that the user is still logged in so that I can prevent them from even opening the form if their session expired (logged out but page hasn't been refreshed).</p>
  
  <p>Here's the pseudo code of what I was trying to do, doesn't work obviously.</p>
  
  <pre><code>// some view.html
  $('#someform').click(function() {
      ajax(URL('login_status'), [], '');
  });
  
  // some controller.py
  def login_status():
      if not auth.user:
          redirect('index')
  </code></pre>