I have a customers area as part of the Craft Commerce site I am working on. Ideally I want the user to be able to update their password from their customer profile screen. I have it working and validating for First Name and Surname. I have made the email address a disabled field so this cannot be changed (as email is used t login).

However, I am having difficulty getting validation for the password fields. If I enter the old password correctly and a new password it does work and updates the password. However, I want some feedback/error trapping on the old password box to ensure the old password was correct and to offer some feedback if the passwords cannot be updated for whatever reason.

Is this something we would need to write to validate the old password, or is this baked into Craft?

Anyone able to point me in the right direction on this?

1 Answer 1


Commerce just relies on existing Craft functionality for this and if you look at UsersController->saveUser, you can see that if the existing password is incorrect, then the error will be added to the UserModel's currentPassword property.

So something like this should work:

    {% for error in user.getErrors('currentPassword') %}
        <li>{{ error }}</li>
    {% endfor %}
  • Thanks for this @BradBell. This works. I will look through the userControllers in the future. Id id have to change it from user.getErrors to account.getErrors -> can I ask what the difference is between user and account and when one instance should be used over another? Oct 5, 2016 at 8:51
  • They're both just UserModel objects named differently. The name will just depend on what the controller returns back to the template.
    – Brad Bell
    Oct 5, 2016 at 17:02

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.