Use cookie to check login status, redirect to login page when not logged in, extracted login page template.