Add template and fix login checks