3

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...

saniya
  • 79
  • 2
  • 8

1 Answers1

9

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?>" />
Marius
  • 197,939
  • 53
  • 422
  • 830
  • The customer won't know what the password is, then, so a reminder email needs to be triggered. – philwinkle Oct 15 '13 at 13:54
  • 1
    @philwinkle. In the standard registration e-mail you get your passoword. – Marius Oct 15 '13 at 13:57
  • Touché, you're absolutely correct. – philwinkle Oct 15 '13 at 14:33
  • 1
    Though, that's typically one of the first things that I alter... – philwinkle Oct 15 '13 at 14:33
  • @philwinkle. I know ...I followed a discussion in here about that. Since then I recommend to my clients to do the same, but in this case I think the default e-mail with the password in it is the way to go. – Marius Oct 15 '13 at 14:35
  • If I recall correctly, the passwords are no longer included in the default email starting in Magento 1.9.1 – Luke A. Leber May 27 '16 at 17:56
  • 1
    @LukeA.Leber. From what I see it's still there: https://github.com/OpenMage/magento-mirror/blob/1.9.2.4/app/locale/en_US/template/email/account_new.html#L25 – Marius May 27 '16 at 19:19
  • @Marius - I'll double-check now, but I'm almost certain that the emails generated have a blank spot where the password used to be. This may have been reversed in recent versions, but check out the security enhancements outlined in http://docs.magento.com/m1/ce/user_guide/magento/release-notes-ce-1.9.1.html?Highlight=release%20notes – Luke A. Leber May 27 '16 at 19:37
  • Missed the 5 minute deadline to edit the above comment -- here's the result when registering to a 1.9.1 demo store: http://imgur.com/2m9hY8P – Luke A. Leber May 27 '16 at 19:44