How to modify the fields of user registration form and user login form? I have user registration and user login form on same page and want to customize the field of both the forms?
Use hook_form_alter() or hook_form_FORM_ID_alter to update anything in the forms:
Example of updating the user login form using hook_form_alter():

function My_Module_form_alter(&amp;$form, &amp;$form_state, $form_id) {
  // Modify the user login form. ('replace the "-" with "_" in form id')
  if ($form_id === 'user_login_block') {
    // Modifying the label and the size of input of username and password.
    $form['name']['#title'] = 'User Name';
    $form['name']['#size'] = '20';
    $form['pass']['#title'] = 'Password';
    $form['pass']['#size'] = '20';

    // Adding extra class to the form.
    $form['#attributes']['class'][] = 'custom-class-name';

    // Adding additional validator to the form for some custom validations.
    $form['#validate'][] = 'My_Module_custom_form_validation';
  }
}