Login and error handling on main page