validating input password; added tests