You are here

function fastly_register_form in Fastly 7

Same name and namespace in other branches
  1. 7.2 fastly.admin.inc \fastly_register_form()

Register form.

1 string reference to 'fastly_register_form'
fastly_menu in ./fastly.module
Implements hook_menu().

File

./fastly.admin.inc, line 78
Administrative forms for Fastly module.

Code

function fastly_register_form($form_state) {
  if (variable_get('fastly_used_registration')) {
    drupal_set_message(t('You are already registered. You can <a href="https://app.fastly.com/#password_reset">reset your password</a> if you don\'t remember it.'), 'warning');
  }
  else {
    global $user;
    $form['owner_first_name'] = array(
      '#type' => 'textfield',
      '#title' => t("First Name"),
      '#description' => t("The customer account owner's first name. Ex: John."),
      '#required' => TRUE,
    );
    $form['owner_last_name'] = array(
      '#type' => 'textfield',
      '#title' => t("Last Name"),
      '#description' => t("The customer account owner's last name. Ex: Smith."),
      '#required' => TRUE,
    );
    $form['owner_login'] = array(
      '#type' => 'textfield',
      '#title' => t("Email"),
      '#default_value' => $user->mail,
      '#description' => t("The owner's email to be used as login. Ex: john@somebusiness.com."),
      '#required' => TRUE,
    );
    $form['owner_password'] = array(
      '#type' => 'password',
      '#title' => t("Password"),
      '#default_value' => '',
      '#required' => TRUE,
    );
    $form['confirm_password'] = array(
      '#type' => 'password',
      '#title' => t("Confirm Password"),
      '#default_value' => '',
      '#description' => t("The customer account owner's password. Please enter 4 or more characters. Ex: P@ssW0rd!1"),
      '#required' => TRUE,
    );
    $form['account_name'] = array(
      '#type' => 'textfield',
      '#title' => t('Company Name'),
      '#default_value' => variable_get('site_name', ''),
      '#description' => t('The customer account name. Ex: Some Business, LLC.'),
      '#required' => TRUE,
    );
    $form['origin_ip'] = array(
      '#type' => 'textfield',
      '#title' => t('Origin Server IP'),
      '#default_value' => $_SERVER['SERVER_ADDR'],
      '#required' => TRUE,
    );
    $form['port'] = array(
      '#type' => 'textfield',
      '#title' => t('Origin Port'),
      '#default_value' => '80',
      '#required' => TRUE,
    );
    $form['domain_name'] = array(
      '#type' => 'textfield',
      '#title' => t('Domain Name'),
      '#default_value' => $_SERVER['HTTP_HOST'],
      '#required' => TRUE,
    );
    $form['actions']['submit'] = array(
      '#type' => 'submit',
      '#value' => t('Sign Up'),
    );
    $form['actions']['already_registered'] = array(
      '#markup' => t('Already registered?') . l(t('Click here to enter your account information and get started!'), 'admin/config/services/fastly/config'),
    );
    $form['policy'] = array(
      '#markup' => '<p>' . t('By clicking "Sign Up" you are agreeing to the <a target="_blank" href="https://www.fastly.com/terms">Terms of Use</a> and <a target="_blank" href="https://www.fastly.com/privacy">Privacy Policy</a>.') . '</p>',
    );
    return $form;
  }
}