You are here

function openid_connect_form_user_form_alter in OpenID Connect / OAuth client 2.x

Same name and namespace in other branches
  1. 8 openid_connect.module \openid_connect_form_user_form_alter()

Implements hook_form_FORM_ID_alter() for user_form.

File

./openid_connect.module, line 85
Hook implementations of the OpenID Connect module.

Code

function openid_connect_form_user_form_alter(&$form, &$form_state) {

  // Whether the current user is allowed to change its password.
  if (\Drupal::service('openid_connect.openid_connect')
    ->hasSetPasswordAccess()) {
    return;
  }
  if (isset($form['account'])) {
    $account_form =& $form['account'];
  }
  else {
    $account_form =& $form;
  }
  $account_form['current_pass']['#access'] = FALSE;
  $account_form['current_pass_required_values']['#value'] = [];
  $account_form['pass']['#access'] = FALSE;
  $account_form['pass']['#required'] = FALSE;
}