merged login and index to properly display login error message