title: Post-login redirection in web2py
body: <p>I'm having trouble controlling post-login redirection behavior in web2py. </p>
  
  <p>According to <a href="http://groups.google.com/group/web2py/msg/c07acc2f4395f6e4" rel="nofollow">this</a>, web2py handles post-login redirection differently, depending on whether the login was initiated by the system (e.g. when accessing a auth-protected function) or by a user (when clicking a 'log in' link). In the former case, the behavior is to redirect to the referring page after login, as would be expected. In the latter, however, the user is redirected to an index page after login, or to a page hardcoded in auth.settings.login_next.</p>
  
  <p>How would I set things up so that post-login redirection always returns you to the referring page, regardless of how the login was initiated?</p>