Refactored the code to handle displaying the login form in several pages.