magento 1.13重置密码不显示错误消息

时间:2016-06-29 07:30:24

标签: php magento

在magento EE 1.13中,重置忘记密码页面,在应用补丁6788后没有显示任何错误消息。这是我的resetPasswordPostAction(),其中错误消息正在添加到会话并重定向到changeForgotten操作

if (!empty($errorMessages)) {
            $this->_getSession()
                ->setCustomerFormData($this->getRequest()->getPost());
            foreach ($errorMessages as $errorMessage) {
                $this->_getSession()->addError($errorMessage);
            }
            $this->_redirect('*/*/changeforgotten');
            return $this;
        }

并在resetforgottenpassword.phtml中显示错误消息,如

<?php echo $this->getMessagesBlock()->getGroupedHtml(); ?>

核心改变原型动作是:

public function changeForgottenAction()
    {
        try {
            list($customerId, $resetPasswordLinkToken) = $this->_getRestorePasswordParameters($this->_getSession());
            $this->_validateResetPasswordLinkToken($customerId, $resetPasswordLinkToken);
            $this->loadLayout();
            $this->renderLayout();

        } catch (Exception $exception) {
            $this->_getSession()->addError($this->_getHelper('customer')->__('Your password reset link has expired.'));
            $this->_redirect('*/*/forgotpassword');
        }
    }

1 个答案:

答案 0 :(得分:0)

在挖掘核心文件后发现,changeForgottenAction()未初始化布局消息。在$this->loadLayout();之后的代码下面使用

        $this->_initLayoutMessages('customer/session');

final changeForgottenAction()动作将是:

public function changeForgottenAction()
    {
        try {
            list($customerId, $resetPasswordLinkToken) = $this->_getRestorePasswordParameters($this->_getSession());
            $this->_validateResetPasswordLinkToken($customerId, $resetPasswordLinkToken);
            $this->loadLayout();
            $this->_initLayoutMessages('customer/session');
            $this->renderLayout();

        } catch (Exception $exception) {
            $this->_getSession()->addError($this->_getHelper('customer')->__('Your password reset link has expired.'));
            $this->_redirect('*/*/forgotpassword');
        }
    }

谢谢!