magento After registration (require email confirmation yes) redirect to cms page

magento After registration (require email confirmation yes) redirect to cms page

August 28, 2026 · Illustrated author avatarBy Stefan Bogdanescu
magento After registration (require email confirmation yes) redirect to cms page

When you enable the “Require Email Confirmation” option in Magento’s customer configuration, the registration process changes to require users to confirm their email addresses before they can log in or access their accounts. This is a security feature that helps prevent account takeovers by ensuring only legitimate users can activate their accounts.

In the CustomerController.php file, the confirmAction() method handles the confirmation of customer accounts. When a user clicks on the confirmation link sent to their email, this action is triggered. The code first checks if the user is already logged in and redirects them away if so.

Then it tries to load the customer account by ID and compare the confirmation key from the request with the one stored for that customer. If they match and the account is confirmed inactive (i.e., there is a confirmation key), the customer is activated by setting their confirmation field to null and saving the changes.

After successfully activating the account, the code logs the user in, sends them a welcome email, and redirects them to the success page using Mage::getUrl('registration-success', array('_secure'=>true)). This URL points to a CMS page that you can customize to display whatever message or information you want users to see after confirming their accounts.

If any part of this process fails (e.g., loading the customer by ID, activating the account, or logging them in), an error is thrown and displayed to the user. The code redirects them back to the index page with a URL parameter indicating that the request was invalid.

To summarize, when you enable email confirmation:

  1. Users will need to confirm their emails before they can access their accounts.
  2. When they click on the confirmation link sent to their email, the confirmAction() is triggered.
  3. The code activates the user’s account and logs them in.
  4. It sends a welcome email and redirects them to the “registration-success” CMS page.
  5. If any errors occur during this process, an error message is displayed.

The key step for redirection is calling $this->redirectSuccess() with the appropriate URL after successfully activating and logging in the user. In the provided code example, it’s already correctly set up to redirect to the “registration-success” CMS page using Mage::getUrl('registration-success', array('_secure'=>true)).

However, if you want to control the redirection behavior more granularly or based on specific conditions (e.g., redirecting users who have confirmed their accounts in a certain way), you can modify the code within the confirmAction() method. For instance, you could add extra checks before calling $this->redirectSuccess() to determine which page to send the user to.

Remember that when modifying core Magento files like CustomerController.php, it’s important to follow best practices for version control and backup your changes properly. Additionally, if you are using a later version of Magento (e.g., 2.x or 2.4), the controller and specific methods may have different structures or names.

In conclusion, when the “Require Email Confirmation” option is enabled, the registration process includes an additional confirmation step for users to activate their accounts via email. The confirmAction() method in CustomerController.php handles this process by activating the account, logging them in, and redirecting them to a success page (usually a CMS page). You can customize or extend this behavior based on your specific requirements.

Security Configuration Email Customers

Our network