Custom form set error for user login validate I have used a custom validate function.

function user_information_form_alter(&amp;$form, &amp;$form_state, $form_id) {
  if ($form_id == 'user_login' || 'user_login_block') {
    array_unshift($form['#validate'],'user_information_user_login_form_validate');
  }
}

function user_information_user_login_form_validate(&amp;$form, &amp;$form_state) {
  // print_r($form_state);
  form_set_error('name', t('Password invalid'));
}


But I am unable to log in to the site any more.
you cant submit your form because you have set the error. 

the form set error should be applied inside some condition

 function user_information_user_login_form_validate(&amp;$form, &amp;$form_state) {
    //print_r($form_state);
    //set some condition 
     if($form_state["some_field"] != "somevalue")// only when the condition satisfies the form set error should display. if not all the time your from set error will be called 
      form_set_error('name', t('Password invalid'));
    }


above condition is a sample condition you have to replace it with your own condition for validating your password.