0

I have my store set up so an account is created for every order (unless the email address already exists in which case the order gets added to the corresponding email addresses account) i would like to give my customers the ability to set the password for their new account on the success page since the account has already been created (without a password) how could I do that? i tried resetting the password with a form like this on the success page

<form action="https://mystore.com/customer/account/resetpasswordpost/?id=<?php echo $order->getCustomerId() ?>&amp;token=......." method="post" id="form-validate">
    <label for="password" class="required"><em>*</em>New Password</label>
        <div class="input-box">
            <input type="password" class="input-text required-entry validate-password" name="password" id="password"></div>
        <label for="confirmation" class="required"><em>*</em>Confirm New Password</label>
            <div class="input-box">
                <input type="password" class="input-text required-entry validate-cpassword" name="confirmation" id="confirmation">
            </div>
        <button type="submit" title="Reset a Password" class="button"><span><span>Create A Password</span></span></button>
    </div>
</form>

but i need a way to get the tokens value any thoughts? thanks

  • You can use editPostAction function instead from account controller, that way, you'd just be replicating how you change password from my account section. – Prateek Mar 10 '16 at 14:23
1

I got the code to get a token

<?php
   $order = Mage::getModel('sales/order')->loadByIncrementId($this->getOrderId());
    $customer = Mage::getModel('customer/customer')
                ->setWebsiteId(Mage::app()->getStore()->getWebsiteId())
                ->loadByEmail($order->getCustomerEmail());
    $newResetPasswordLinkToken = Mage::helper('customer')->generateResetPasswordLinkToken();
    $customer->changeResetPasswordLinkToken($newResetPasswordLinkToken);
?>
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.