Validates login and register