Currently, change password form is on the same page as account edit information, is there any way to separate change password to different page.

I'm new to Magento & don't know, how to create a custom page can be made in Magento.

2 Answers 2


I might be late in answering but this will surely help at least others. Magento has an existing separate file for change password. We are going to use that. The file path is:


It is not defined in any of the layout files so firstly we will have to mention it in a layout file. I mentioned it in local.xml Since I wanted to use it in customer/account/edit page only but the change password form to be separate from the edit account form I mentioned it under customer_account_edit. You can change the layout handle according to your preference.

In your theme's local.xml file add:

 <reference name="my.account.wrapper">
  <block type="customer/form_edit" name="customer_edit" template="customer/form/edit.phtml">
          <block type="core/template" name="change_password" template="customer/form/changepassword.phtml"/>

In your customer/form/edit.phtml just add this line after the form tag closes:

<?php echo $this->getChildHtml('change_password'); ?>

In your changepassword.phtml file add the form key inside your <form> by adding this line:

<?php echo $this->getBlockHtml('formkey') ?>

Also, add a hidden field in changepassword.phtml file:

<input type="hidden" name="change_password" id="change_password" value="1" />

And you are good to go!


First check how to create custom page.Please study here

=> Step1: First of all create module control file Module name as Amit_Custommodule.xml at app/etc/modules/

Code is:

<?xml version="1.0"?>

=> Step2: For create custom route then you need to create config.xml at app/code/community/Amit/Custommodule/etc/

<?xml version="1.0" ?>
    <!-- start of routers 

**=> Step 3: Create Controller file where you have show password change form and post action **

class Amit_Custommodule_IndexController extends Mage_Core_Controller_Front_Action{

    protected function _getSession()
        return Mage::getSingleton('customer/session');
     public function _getModel($path, $arguments = array())
        return Mage::getModel($path, $arguments);

    public function editPostAction()

        if ($this->getRequest()->isPost()) {
            /** @var $customer Mage_Customer_Model_Customer */
            $customer = $this->_getSession()->getCustomer();

            /** @var $customerForm Mage_Customer_Model_Form */
            $customerForm = $this->_getModel('customer/form');

            $customerData = $customerForm->extractData($this->getRequest());

            $errors = array();
            $customerErrors = $customerForm->validateData($customerData);
            if ($customerErrors !== true) {
                $errors = array_merge($customerErrors, $errors);
            } else {
                $errors = array();

                // If password change was requested then add it to common validation scheme
                if ($this->getRequest()->getParam('change_password')) {
                    $currPass   = $this->getRequest()->getPost('current_password');
                    $newPass    = $this->getRequest()->getPost('password');
                    $confPass   = $this->getRequest()->getPost('confirmation');

                    $oldPass = $this->_getSession()->getCustomer()->getPasswordHash();
                    if ( $this->_getHelper('core/string')->strpos($oldPass, ':')) {
                        list($_salt, $salt) = explode(':', $oldPass);
                    } else {
                        $salt = false;

                    if ($customer->hashPassword($currPass, $salt) == $oldPass) {
                        if (strlen($newPass)) {
                             * Set entered password and its confirmation - they
                             * will be validated later to match each other and be of right length
                        } else {
                            $errors[] = $this->__('New password field cannot be empty.');
                    } else {
                        $errors[] = $this->__('Invalid current password');

                // Validate account and compose list of errors if any
                $customerErrors = $customer->validate();
                if (is_array($customerErrors)) {
                    $errors = array_merge($errors, $customerErrors);

            if (!empty($errors)) {
                foreach ($errors as $message) {
                return $this;

            try {
                    ->addSuccess($this->__('The account information has been saved.'));

            } catch (Mage_Core_Exception $e) {
            } catch (Exception $e) {
                    ->addException($e, $this->__('Cannot save the customer.'));

  • Thank You for the helo Amit, how to access this via URL? Commented Mar 23, 2015 at 5:19
  • Hi! And how to define custommodule.xml to show the password change form? Commented Feb 26, 2017 at 1:42
  • I've tried it like this as well: class Web3d_ChangePassword_IndexController extends Mage_Core_Controller_Front_Action{ public function indexAction() { $this->loadLayout(); $this->_initLayoutMessages('customer/session'); $this->_initLayoutMessages('catalog/session'); $this->getLayout()->getBlock('content')->append( $this->getLayout()->createBlock('customer/account_dashboard') ); $this->getLayout()->getBlock('head')->setTitle($this->__('My Account')); $this->renderLayout(); } Commented Feb 26, 2017 at 1:42

Your Answer

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

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