added login and register pages and 400 error handling