Answers.Body: <p>Commerce just relies on existing Craft functionality for this and if you look at <a href="https://github.com/pixelandtonic/Craft-Release/blob/master/app/controllers/UsersController.php#L915-L920" rel="nofollow">UsersController->saveUser</a>, you can see that if the existing password is incorrect, then the error will be added to the UserModel's currentPassword property.</p>
  
  <p>So something like this should work:</p>
  
  <pre><code>&lt;ul&gt;
      {% for error in user.getErrors('currentPassword') %}
          &lt;li&gt;{{ error }}&lt;/li&gt;
      {% endfor %}
  &lt;/ul&gt;
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-10-05T08:51:56.840Z
Answers.Text: 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?
Answers.UserDisplayName: Terry Upton
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-10-05T17:02:46.407Z
Answers.Text: They're both just UserModel objects named differently.  The name will just depend on what the controller returns back to the template.
Answers.UserDisplayName: Brad Bell
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-10-04T18:01:36.953Z
Answers.LastActivityDate: 2016-10-05T17:01:43.227Z
Answers.LastEditDate: 2016-10-05T17:01:43.227Z
Answers.UserDisplayName: Brad Bell
Body: <p>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).</p>
  
  <p>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.</p>
  
  <p>Is this something we would need to write to validate the old password, or is this baked into Craft? </p>
  
  <p>Anyone able to point me in the right direction on this?</p>
  
Tags: <users><plugin-craftcommerce><user-profile><validation>
Title: Change password on user profile (customer account in Craft Commerce)
ThreadText: # Change password on user profile (customer account in Craft Commerce)
  
  (Asked by: username_0 on 2016-10-04)
  
  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?
  
  **Tags:** users, plugin-craftcommerce, user-profile, validation
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2016-10-04. Score: 1 | Accepted answer
  
  Commerce just relies on existing Craft functionality for this and if you look at [UsersController->saveUser](https://github.com/pixelandtonic/Craft-Release/blob/master/app/controllers/UsersController.php#L915-L920), 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:
  
  ```
  <ul>
      {% for error in user.getErrors('currentPassword') %}
          <li>{{ error }}</li>
      {% endfor %}
  </ul>
  
  ```
  
  > **Comments:**
  > **username_0**: Thanks for this @username_1. 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?  
  > **username_1**: They're both just UserModel objects named differently.  The name will just depend on what the controller returns back to the template.  
  
  ---
  
  