Refactored the session controller so that it can be easily customized.

* Renamed ApplicationController to BaseController.
* Moved common functionality from the SessionController to the BaseController.
* In order to customize, subclasses should inherit from the BaseController.