validating input password; added tests

fixes #1