Integrating session model into templates and login form processing.