You are here

function miniorange_saml_customer_setup in SAML SP 2.0 Single Sign On (SSO) - SAML Service Provider 7

1 string reference to 'miniorange_saml_customer_setup'
miniorange_saml_menu in ./miniorange_saml.module

File

./miniorange_saml_customer_setup.inc, line 12
Contains form for customer setup.

Code

function miniorange_saml_customer_setup($form, &$form_state) {
  drupal_add_css(drupal_get_path('module', 'miniorange_saml') . '/css/style_settings.css', array(
    'group' => CSS_DEFAULT,
    'every_page' => FALSE,
  ));
  $current_status = variable_get('miniorange_saml_status', '');
  if ($current_status == 'VALIDATE_OTP') {
    $form['miniorange_saml_customer_otp_token'] = array(
      '#type' => 'textfield',
      '#title' => t('OTP<span class="miniorange_saml_red">*</span>'),
      '#attributes' => array(
        'style' => 'width:45%',
      ),
      '#prefix' => '<div class="mo_saml_table_layout_1"><div class="mo_saml_table_layout mo_saml_container">',
      '#description' => t('Please enter the OTP that has been sent to the registered Email ID.'),
    );
    $form['miniorange_saml_customer_validate_otp_button'] = array(
      '#type' => 'submit',
      '#value' => t('Validate OTP'),
      '#submit' => array(
        'miniorange_saml_validate_otp_submit',
      ),
    );
    $form['miniorange_saml_customer_setup_resendotp'] = array(
      '#type' => 'submit',
      '#value' => t('Resend OTP'),
      '#submit' => array(
        'miniorange_saml_resend_otp',
      ),
    );
    $form['miniorange_saml_customer_setup_back'] = array(
      '#type' => 'submit',
      '#value' => t('Back'),
      '#submit' => array(
        'miniorange_saml_back',
      ),
      '#suffix' => '<br><br><br><br><br><br><br><br><br><br><br><br>
                    </div>',
    );
    Utilities::spConfigGuide($form, $form_state);
    Utilities::AddSupportButton($form, $form_state);
    return $form;
  }
  elseif ($current_status == 'PLUGIN_CONFIGURATION') {
    $form['header_top_style_1'] = array(
      '#markup' => '<div class="mo_saml_table_layout_1"><div class="mo_saml_table_layout mo_saml_container">
                        <div class="mo_saml_welcome_message">Thank you for registering with miniOrange</div><br><br>
                        <h4>Your Profile: </h4>',
    );
    $header = array(
      'email' => array(
        'data' => t('Customer Email'),
      ),
      'customerid' => array(
        'data' => t('Customer ID'),
      ),
      'token' => array(
        'data' => t('Token Key'),
      ),
      'apikey' => array(
        'data' => t('API Key'),
      ),
    );
    $options = array();
    $options[0] = array(
      'email' => variable_get('miniorange_saml_customer_admin_email', ''),
      'customerid' => variable_get('miniorange_saml_customer_id', ''),
      'token' => variable_get('miniorange_saml_customer_admin_token', ''),
      'apikey' => variable_get('miniorange_saml_customer_api_key', ''),
    );
    $form['fieldset']['customerinfo'] = array(
      '#theme' => 'table',
      '#header' => $header,
      '#rows' => $options,
    );
    $form['miniorange_saml_customer_Remove_Account_info'] = array(
      '#markup' => '<br><br><br><br><br><br><br><h4>Remove Account: </br></h4><p>This section will help you to remove your current logged in account without losing your current configurations.</p>',
    );
    $form['miniorange_saml_remove_account_button'] = array(
      '#type' => 'submit',
      '#value' => t('Remove Account '),
      '#submit' => array(
        'miniorange_saml_remove_account',
      ),
      '#suffix' => '<br></div>',
    );
    Utilities::spConfigGuide($form, $form_state);
    Utilities::AddSupportButton($form, $form_state);
    return $form;
  }
  $form['header_top_style_1'] = array(
    '#markup' => '<div class="mo_saml_table_layout_1">
                    <div class="mo_saml_table_layout mo_saml_container" id="mo_saml_vt_register"><b>
                    <span style="font-size: 19px;">Register/Login with miniOrange (Optional)</span></b><br><br><hr>
                    <div class="mo_saml_register_message">You need to <a>Register/login</a> with miniOrange before upgrade to our paid version of the module.</div>',
  );
  $form['markup_15'] = array(
    '#markup' => '<br><div class="mo_saml_highlight_background_note_1" style="width: auto"><h3>Why Should I register?</h3>You should register so that in case you need help, we can help you with step by step instructions.
                    We support all known IdPs - ADFS, Okta, Salesforce, Shibboleth, SimpleSAMLphp, OpenAM, Centrify, Ping, RSA, IBM, Oracle, OneLogin, Bitium, WSO2 etc.
                    <b>You will also need a miniOrange account to upgrade to the standard, premium or enterprise versions of the modules.</b> We do not store any information except the email that you will use to register with us.</div>',
  );
  $form['mo_register'] = array(
    '#markup' => '<br><div class="mo_saml_highlight_background_note_1" style="width: auto">If you face any issues during registration then you can <a href="https://www.miniorange.com/businessfreetrial" target="_blank">click here</a> to register and use the same credentials below to login into the module.</div><br>',
  );
  $form['miniorange_saml_customer_setup_username'] = array(
    '#type' => 'textfield',
    '#title' => t('Email<span class="miniorange_saml_red">*</span>'),
    '#attributes' => array(
      'style' => 'width:60%',
    ),
    '#description' => t('<b>Note:</b> Use valid Email. (We discourage the use of disposable emails)'),
  );
  $form['miniorange_saml_customer_setup_phone'] = array(
    '#type' => 'textfield',
    '#title' => t('Phone'),
    '#attributes' => array(
      'style' => 'width:60%',
      'pattern' => '[\\+][0-9]{1,4}\\s?[0-9]{7,12}',
      'placeholder' => 'Enter your phone number with country code (+1)',
    ),
    '#description' => t('<b>Note:</b> We will only call if you need support.'),
  );
  $form['miniorange_saml_customer_setup_password'] = array(
    '#type' => 'password_confirm',
    '#description' => t('<b>Note:</b> Minimum Length is 6.'),
  );
  $form['miniorange_saml_customer_setup_button'] = array(
    '#type' => 'submit',
    '#value' => t('Submit'),
    '#submit' => array(
      'miniorange_saml_customer_setup_submit',
    ),
    '#attributes' => array(
      'class' => array(
        'mo_saml_save_mapping_config_button',
      ),
    ),
    '#suffix' => '</div>',
  );
  Utilities::Two_FA_Advertisement($form, $form_state);
  Utilities::AddSupportButton($form, $form_state);
  return $form;
}