function shib_auth_custom_data in Shibboleth Authentication 6.4
Same name and namespace in other branches
- 7.4 shib_auth_forms.inc \shib_auth_custom_data()
Generate the custom e-mail and username provider form @returns HTML text of the custom data form
3 string references to 'shib_auth_custom_data'
- shib_auth_custom_form in ./
shib_auth.module - If any customization or consent option is enabled, the custom form will show up before registering and forces the user to accept user consent and define username and/or e-mail address (prefilling fields with the data coming from the…
- shib_auth_init in ./
shib_auth.module - Create a new user based on informations from the Shibboleth handler if it's necessary or log in.
- shib_auth_menu in ./
shib_auth.module - Generate the menu element to access the Shibboleth authentication module's administration page @returns HTML text of the administer menu element
File
- ./
shib_auth_forms.inc, line 124 - Drupal forms of the Shibboleth authentication module.
Code
function shib_auth_custom_data() {
global $user;
$form = array();
//Decide if the user is already registered, but a new consent version is present
$auth_map_un_query = db_query("SELECT * FROM {shib_authmap} WHERE targeted_id='%s'", $_SERVER[shib_auth_config('username_variable')]);
$authmap_username = db_fetch_array($auth_map_un_query);
//if the user already registered, display a message about consent version change
if ($authmap_username) {
$form['consent'] = array(
'#value' => t('The terms of use document has been modified since your last login with id @targetedid. Please read it carefully, and click on Submit if you accept the new version. Version you have accepted: @accepted - document version: @documentver', array(
'@targetedid' => $authmap_username['targeted_id'],
'@accepted' => $authmap_username['consentver'],
'@documentver' => shib_auth_config('terms_ver'),
)),
);
}
else {
//username textfield is writable, if define_username variable is true
if (shib_auth_config('define_username')) {
$form['custom_username'] = array(
'#type' => 'textfield',
'#title' => t('Desired username'),
'#default_value' => $_SERVER[shib_auth_config('username_variable')],
'#size' => 60,
);
}
else {
$form['custom_usernamem'] = array(
'#value' => t('<b>Username:</b> <br />'),
);
$form['custom_username'] = array(
'#value' => $_SERVER[shib_auth_config('username_variable')],
'#suffix' => '<br />',
);
}
if (shib_auth_config('enable_custom_mail')) {
//mail textfield is writable, if define_username variable is true
$form['custom_mail'] = array(
'#type' => 'textfield',
'#title' => t('E-mail'),
'#default_value' => $_SERVER[shib_auth_config('email_variable')],
'#size' => 60,
);
}
else {
$form['custom_mailm'] = array(
'#value' => t('<b>E-mail:</b> <br />'),
);
$form['custom_mail'] = array(
'#value' => $_SERVER[shib_auth_config('email_variable')],
'#suffix' => '<br />',
);
}
}
//display terms of use link, if it is required by admin
if (shib_auth_config('terms_accept')) {
$form['accept'] = array(
'#type' => 'checkbox',
'#title' => t('I accept the <a href="@link" target="_blank">terms and conditions</a>', array(
'@link' => url(shib_auth_config('terms_url')),
)),
);
}
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Send'),
);
$form['cancel'] = array(
'#type' => 'submit',
'#value' => t('Cancel'),
);
return $form;
}