validate_user: fixes and tests.