The correct way to change the password for web mail is sign in web browser say safari , if you are using gmail , yahoo or any it will prompt to enter the previous password , don't fill up the password field , click on Forget & uncheck the box of don't remember , follow the upcoming steps , you must also create a rescue mail lastly click on save .
Note : if you are using IMAP account , it is an mail application that is just configured with YOUR WEB MAIL , passwords are saved on their servers .
You are just connected to the servers so if the user is changing from mail application whats the use of saving the passwords on their servers ( passwords are in encrypted form for the security reason ) .
Once you have changed the password it will be automatically set up in mail preferences > account information > password .
Do an experiment : change password if it shows four dots , then again make a new lengthy password and change it will show more than four dots . You can compare that what you saved on the web mail will reflect in your IMAP account , but it will be always be encrypted as original password is with you , that must be written in a safe place .