How to mandate the password policy in custom form fields?
You can use the 'password_confirm" #type in your form to get the exact field Drupal uses. 

Add this to your Form function.

$form['account']['pass'] = array(
      '#type' =&gt; 'password_confirm',
      '#size' =&gt; 25,
      '#description' =&gt; t('To set or change the password, enter the new password in both fields.'),
    );


This will give you the field, javascript and the validator without any extra code.