login template and errors handle