You are here

function simplesamlphp_auth_user_form_includes in simpleSAMLphp Authentication 8.3

Helper function to include the SimpleSAML checkbox on user forms.

Parameters

array $form: The user account form.

See also

simplesamlphp_auth_form_user_form_alter()

simplesamlphp_auth_form_user_register_form_alter()

simplesamlphp_auth_user_form_submit()

2 calls to simplesamlphp_auth_user_form_includes()
simplesamlphp_auth_form_user_form_alter in ./simplesamlphp_auth.module
Implements hook_form_FORM_ID_alter().
simplesamlphp_auth_form_user_register_form_alter in ./simplesamlphp_auth.module
Implements hook_form_FORM_ID_alter().

File

./simplesamlphp_auth.module, line 151
SimpleSAMLphp authentication module for Drupal.

Code

function simplesamlphp_auth_user_form_includes(array &$form) {
  $form['simplesamlphp_auth_user_enable'] = [
    '#type' => 'checkbox',
    '#title' => t('Enable this user to leverage SAML authentication'),
    '#access' => \Drupal::currentUser()
      ->hasPermission('change saml authentication setting'),
    '#description' => t("WARNING: if unchecked, this will become a local Drupal user, which might be denied access based on the SimpleSAMLphp settings for authenticating local Drupal accounts.<br />Don't use this setting for access control, which should be configured in your IdP instead.<br />NOTE: if the configuration option 'Automatically enable SAML authentication for existing users upon successful login' is activated, this Drupal account can become linked with SAML (again) when the user succesfully authenticates to the IdP."),
  ];

  // We store the authname as the initial email. If we're using SimpleSAML we
  // need to enforce an email address.
  $form['account']['mail']['#required'] = TRUE;
  $form['actions']['submit']['#submit'][] = 'simplesamlphp_auth_user_form_submit';
}