You are here

function _services_keyauth_alter_browse_form in Services 7

Same name and namespace in other branches
  1. 6.2 auth/services_keyauth/services_keyauth.inc \_services_keyauth_alter_browse_form()
1 string reference to '_services_keyauth_alter_browse_form'
services_keyauth_authentication_info in auth/services_keyauth/services_keyauth.module
Implements hook_authentication_info().

File

auth/services_keyauth/services_keyauth.inc, line 111
The implementation of the key authentication scheme

Code

function _services_keyauth_alter_browse_form(&$form, $method) {
  foreach ($method['#args'] as $key => $arg) {
    switch ($arg['#name']) {
      case 'hash':
        $form['arg'][$key] = array(
          '#title' => 'Hash',
          '#type' => 'textfield',
          '#value' => t('Gets generated after form submission'),
          '#disabled' => TRUE,
        );
        break;
      case 'sessid':
        $form['arg'][$key]['#default_value'] = session_id();
        break;
      case 'domain_name':
        $form['arg'][$key]['#default_value'] = $_SERVER['HTTP_HOST'];
        break;
      case 'domain_time_stamp':
        $form['arg'][$key] = array(
          '#title' => 'Timestamp',
          '#type' => 'textfield',
          '#value' => t('Gets generated after form submission'),
          '#disabled' => TRUE,
        );
        break;
      case 'nonce':
        $form['arg'][$key]['#default_value'] = user_password();
        break;
    }
  }
}