Yes. Although the iPhone does not have a mechanism to detect WiFi passwords, there are still various ways to accomplish so without jailbreaking your device.