Fixed password encryption and added API test