Magento – How to generate random password for new customer while creating account in magento

customer

I dont want my customer to enter password while creating account in magento.When customer creates account password should be auto generated and mail should be sent to that customer .Can anybody help me out plz…

Best Answer

You can make the password input in the registration and checkout process as a hidden input and have an algorithm that generates random values for it.
For example at registration you have these fields for passwords

<input type="password" name="password" id="password" title="<?php echo $this->__('Password') ?>" class="input-text required-entry validate-password" />

and

<input type="password" name="confirmation" title="<?php echo $this->__('Confirm Password') ?>" id="confirmation" class="input-text required-entry validate-cpassword" />

Turn them into this:

<?php $password = Mage::helper('core')->getRandomString($length = 7)?>

<input type="hidden" name="password" id="password" title="<?php echo $this->__('Password') ?>" class="input-text required-entry validate-password" value="<?php echo $password?>"  />

and

<input type="hidden" name="confirmation" title="<?php echo $this->__('Confirm Password') ?>" id="confirmation" class="input-text required-entry validate-cpassword" value="<?php echo $password?>" />
Related Topic