function gauth_user in Google Auth 6
Implementation of hook_user().
File
- ./
gauth.module, line 44
Code
function gauth_user($op, &$edit, &$account, $category = NULL) {
switch ($op) {
// Authenticate the user with their Google Apps account.
case 'login':
if (user_access('authenticate with google apps')) {
_gauth_gapps_authenticate($account);
}
break;
// Add a field for the Google Apps email address to their profile form.
case 'form':
// If drupalgapps_ui module exists, it will add the field to the profile.
if ($category == 'account' && user_access('administer gauth') && !module_exists('drupalgapps_ui')) {
$form['gapps_account_mail'] = array(
'#type' => 'textfield',
'#title' => t('Google Apps e-mail address'),
'#default_value' => !empty($edit['gapps_account_mail']) ? $edit['gapps_account_mail'] : '',
);
return $form;
}
break;
case 'validate':
if (!module_exists('drupalgapps_ui')) {
return array(
'gapps_account_mail' => isset($edit['gapps_account_mail']) ? $edit['gapps_account_mail'] : '',
);
}
case 'insert':
if (!module_exists('drupalgapps_ui')) {
$edit['gapps_account_mail'] = '';
}
break;
}
}