check if the new password matched the requirements; code cleanup