diff --git a/password_policy.module b/password_policy.module
index 7727ab4..3d56451 100644
--- a/password_policy.module
+++ b/password_policy.module
@@ -474,10 +474,9 @@ function password_policy_user_delete($account) {
 function password_policy_form_alter(&$form, &$form_state, $form_id) {
   global $user;
 
-  switch ($form_id) {
-    case 'user_profile_form':
-    case 'user_register_form':
-    case 'password_policy_password_tab':
+  // Determines whether form has at least one account password element.
+  $password_elements = _password_policy_get_account_password_elements($form);
+  if (!empty($password_elements)) {
       // Timing issues require reloading the user object to get the
       // password_change property set.
       $account = user_load($user->uid);
@@ -511,6 +510,10 @@ function password_policy_form_alter(&$form, &$form_state, $form_id) {
       if ($form_id == 'user_register_form') {
         $roles = array(DRUPAL_AUTHENTICATED_RID);
       }
+      if (count($roles) == 1 && in_array(DRUPAL_ANONYMOUS_RID, $roles)) {
+        // Is custom registration form.
+        $roles = array(DRUPAL_AUTHENTICATED_RID);
+      }
       $policy = _password_policy_load_active_policy($roles);
 
       $translate = array();
@@ -527,25 +530,58 @@ function password_policy_form_alter(&$form, &$form_state, $form_id) {
       // Printing out the restrictions.
       if (variable_get('password_policy_show_restrictions', 0) && isset($translate) && (isset($form['pass']) || isset($form['account']['pass']))) {
         $restriction_html = '<div id="account-pass-restrictions">' . theme('item_list', array('items' => array_values($translate), 'title' => t('Password Requirements'))) . '</div>';
-        if (isset($form['account']) && is_array($form['account'])) {
-          $form['account']['pass']['#prefix'] = $restriction_html;
-        }
-        else {
-          $form['pass']['#prefix'] = $restriction_html;
+
+        // Get form element by keys (allow for multiple level fieldsets).
+        foreach ($password_elements as $password_element) {
+          $element = $form;
+          foreach ($password_element as $element_key) {
+            $element = $element[$element_key];
+          }
+          $element['#prefix'] = $restriction_html;
         }
       }
 
       // Set a custom form validate and submit handlers.
       $form['#validate'][] = 'password_policy_password_validate';
-      break;
+  }
 
-    case 'password_policy_password_tab':
-      $form['submit']['#weight'] = 10;
-      break;
+  if ($form_id == 'password_policy_password_tab') {
+    $form['submit']['#weight'] = 10;
   }
 }
 
 /**
+ * Returns account password elements in a form.
+ *
+ * Get form elements keys (allow for multiple level fieldsets).
+ */
+function _password_policy_get_account_password_elements($form, $parent_key = NULL) {
+  $password_elements = array();
+  foreach (element_children($form) as $key) {
+    if (isset($form[$key]['#type'])) {
+      switch ($form[$key]['#type']) {
+        case 'password_confirm':
+          if (isset($parent_key)) {
+            $password_elements[] = array($parent_key, $key);
+          }
+          else {
+            $password_elements[] = array($key);
+          }
+          break;
+        case 'fieldset':
+        case 'container':
+          $password_elements = array_merge($password_elements, _password_policy_get_account_password_elements($form[$key], $key));
+          break;
+      }
+    }
+    elseif (is_array($form[$key])) {
+      $password_elements = array_merge($password_elements, _password_policy_get_account_password_elements($form[$key], $key));
+    }
+  }
+  return $password_elements;
+}
+
+/**
  * Implements hook_cron().
  */
 function password_policy_cron() {
@@ -746,10 +782,25 @@ function password_policy_password_validate($form, &$form_state) {
     }
   }
 
-  if (!empty($values['pass']) && !isset($values['auth_openid'])) {
-    $error = _password_policy_constraint_validate($values['pass'], $account);
-    if ($error) {
-      form_set_error('pass', t('Your password has not met the following requirement(s):') . '<ul><li>' . implode('</li><li>', $error) . '</li></ul>');
+  if (!isset($values['auth_openid'])) {
+    // Get form element by keys (allow for multiple level fieldsets).
+    $password_elements = _password_policy_get_account_password_elements($form);
+    foreach ($password_elements as $password_element) {
+      $element = $values;
+      $form_set_error_key = '';
+      foreach ($password_element as $element_key) {
+        if (array_key_exists($element_key, $element)) {
+          $element = $element[$element_key];
+        }
+        if (!empty($form_set_error_key)) {
+          $form_set_error_key .= '][';
+        }
+        $form_set_error_key .= $element_key;
+      }
+      $error = _password_policy_constraint_validate($element, $account);
+      if ($error) {
+        form_set_error($form_set_error_key, t('Your password has not met the following requirement(s):') . '<ul><li>' . implode('</li><li>', $error) . '</li></ul>');
+      }
     }
   }
 }
