Magento change password reset email template

emailforgot-passwordmagentotemplates

I'm building an e-commerce website using magento 1.6.1.0. I'm using one extension that will force users to login before entering into website. Everything is going fine the problem is only with forgotpassword reset link. That extension is blocking this reset password link also. I didn't got any support from that extension team.

Today morning i worked in email template to change magento default logo. At that time i got one idea that while creating a new account we'll get a details of email, password. why can't we use that email template instead of reset password link template?

I tried copy pasting all contents from account_new.html to account_password_reset_confirmation.html from app/locale/en_US/template/email

After doing these changes i got a email with emailL:xxx@mydomain.com & Password:

I got the mail as empty password field.

Please guide me to change the template of forgot password from account_password_reset_confirmation.html to account_new.html so that i can send the password directly.

Best Answer

may i have your code to debug if you use

$customer = Mage::getModel("customer/customer");
         $customer->setWebsiteId(Mage::app()->getWebsite()->getId());
         $customer->getPassword();

it wont work. password will be encrypted in the database. so you cant make use of it. the only way is generating new password and update it in the database and send the new password to the user mail.

sample code to generate custom password

$alphabet = "abcdefghijklmnopqrstuwxyzABCDEFGHIJKLMNOPQRSTUWXYZ0123456789";     //Random password generation
             $pass = array(); //remember to declare $pass as an array
             $alphaLength = strlen($alphabet) - 1; //put the length -1 in cache
             for ($i = 0; $i < 6; $i++) {
                 $n = rand(0, $alphaLength);
                 $pass[] = $alphabet[$n];
             }
             $newpassword =implode($pass);