The simplest way to do this is to have the password entered twice, and then check that they are identical.
A few simple form attributes can have the same effect as reams of Java Script code libraries.
Here we have an enhanced version of the above code where we've added HTML5 handler to the first password field which updates the pattern required by the second password field - in effect forcing them to be identical: Here you can see a screen shot from Safari of the form being completed.
The form below has three input fields: username, pwd1 and pwd2. If a false value is returned then the form submission is cancelled.
This code will work for browsers as far back as Netscape 4 (circa 1997). If you're not sure how to place this on your page, you might need to read the preceding article on Form Validation, or view the HTML source of this page.
The code presented below would then be used for letting the user change their password.