Template fixes and helpers for login