Login form handling and login template modifications