You are here

function cas_user_insert in CAS 7

Implements hook_user_insert().

When a user is created, record their CAS username if provided.

File

./cas.module, line 567
Enables users to authenticate via a Central Authentication Service (CAS) Cas will currently work if the auto registration is turned on and will create user accounts automatically.

Code

function cas_user_insert(&$edit, $account, $category) {
  if (!empty($edit['cas_name'])) {
    db_insert('cas_user')
      ->fields(array(
      'cas_name' => $edit['cas_name'],
      'uid' => $account->uid,
    ))
      ->execute();
  }

  // Update $account to reflect changes.
  $users = array(
    $account->uid => $account,
  );
  cas_user_load($users);
}