Added input validation and test for verifyCredentials().