Add tests for login and move validation of login to backend.