You are here

function drd_agent_authorize in DRD Agent 6.3

Same name and namespace in other branches
  1. 7.3 drd_agent.admin.inc \drd_agent_authorize()

Form to authorize DRD authorization by the admin.

Parameters

$form_state:

Return value

array

1 string reference to 'drd_agent_authorize'
drd_agent_menu in ./drd_agent.module
Implements hook_menu().

File

./drd_agent.admin.inc, line 53

Code

function drd_agent_authorize(&$form_state) {
  $form = array();
  if (empty($_SESSION['drd_agent_authorization_values'])) {
    $form['token'] = array(
      '#type' => 'textarea',
      '#title' => t('Authentication token'),
      '#description' => t('Paste the token for this domain from the DRD dashboard, which you want to authorize.'),
      '#default_value' => '',
      '#required' => TRUE,
    );
    $submit = t('Validate');
  }
  else {
    $form['attention'] = array(
      '#type' => 'markup',
      '#value' => t('You are about to grant admin access to the Drupal Remote Dashboard on the following domain:'),
      '#prefix' => '<div>',
      '#suffix' => '</div>',
    );
    $form['domain'] = array(
      '#type' => 'markup',
      '#value' => _drd_agent_get_domain($_SESSION['drd_agent_authorization_values']),
      '#prefix' => '<div class="domain">',
      '#suffix' => '</div>',
    );
    $form['cancel'] = array(
      '#type' => 'submit',
      '#value' => t('Cancel'),
    );
    $submit = t('Grant admin access');
  }
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => $submit,
  );
  $form['#attributes'] = array(
    'class' => 'drd-agent-auth',
  );
  drupal_add_css(drupal_get_path('module', 'drd_agent') . '/drd_agent.css');
  return $form;
}