Move login to templates.