Added logic to generate pwd based on settings

Added comments on php methods. Also added logic to generate user
password based on the selected settings