1

when I make a request for a link to reset an admin password, the URL is sent to the email without params, like this:

    https://url_magento/index.php/customer/account/resetpassword/

So, without params, obviously the users can't reset their passwords.

The function sending the email is this:

public function forgotpasswordAction()
{
    $email = (string) $this->getRequest()->getParam('email');
    $params = $this->getRequest()->getParams();

    if (!empty($email) && !empty($params)) {
        // Validate received data to be an email address
        if (Zend_Validate::is($email, 'EmailAddress')) {
            $collection = Mage::getResourceModel('admin/user_collection');
            /** @var $collection Mage_Admin_Model_Resource_User_Collection */
            $collection->addFieldToFilter('email', $email);
            $collection->load(false);

            if ($collection->getSize() > 0) {
                foreach ($collection as $item) {
                    $user = Mage::getModel('admin/user')->load($item->getId());
                    if ($user->getId()) {
                        $newResetPasswordLinkToken = Mage::helper('admin')->generateResetPasswordLinkToken();
                        $user->changeResetPasswordLinkToken($newResetPasswordLinkToken);
                        $user->save();
                        $user->sendPasswordResetConfirmationEmail();
                    }
                    break;
                }
            }
            $this->_getSession()
                ->addSuccess(Mage::helper('adminhtml')->__('If there is an account associated with %s you will receive an email with a link to reset your password.', Mage::helper('adminhtml')->escapeHtml($email)));
            $this->_redirect('*/*/login');
            return;
        } else {
            $this->_getSession()->addError($this->__('Invalid email address.'));
        }
    } elseif (!empty($params)) {
        $this->_getSession()->addError(Mage::helper('adminhtml')->__('The email address is empty.'));
    }
    $this->loadLayout();
    $this->renderLayout();
}

Is the same of the core on:

app/code/core/Mage/Adminhtml/controllers/IndexController.php

This only happens with de administrator users, the customers from the stores are working fine.

The Magento version is: 1.9.1.0

The url code on the email template is:

{{store url="customer/account/resetpassword/" _query_id=$customer.id _query_token=$customer.rp_token}}

Any ideas?

Thanks a lot.

3
  • 1
    Hmmm "customer.id" for the backend? That does not sound right. Which template are you looking at? Sep 14, 2016 at 6:18
  • Not sure what you're doing but /customer/account/resetpassword is only for CUSTOMERS (frontend). Admins can change their password in the admin panel. Sep 14, 2016 at 10:42
  • I have experienced the same issue in 1.9.1.0. Did you happen to find a solution? Apr 19, 2017 at 17:11

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.