You are here

function simplesaml_auth_user_profile_form_submit in simpleSAMLphp Authentication 7.3

Submit callback to enable SAML authentication for a given user.

1 string reference to 'simplesaml_auth_user_profile_form_submit'
simplesamlphp_auth_form_alter in ./simplesamlphp_auth.module
Implements hook_form_alter().

File

./simplesamlphp_auth.module, line 342
simpleSAMLphp authentication module for Drupal.

Code

function simplesaml_auth_user_profile_form_submit(&$form, $form_state) {
  $values = $form_state['values'];
  if (isset($values['saml'])) {

    // Enter this username into the authmap table.
    if ($values['saml']) {
      db_merge('authmap')
        ->key(array(
        'uid' => $values['uid'],
        'module' => 'simplesamlphp_auth',
      ))
        ->fields(array(
        'authname' => $values['name'],
      ))
        ->execute();
    }
    else {
      db_delete('authmap')
        ->condition('uid', $values['uid'])
        ->execute();
    }
  }
}