You are here

function miniorange_oauth_client_customer_setup in Drupal OAuth & OpenID Connect Login - OAuth2 Client SSO Login 7

Customer setup form().

1 string reference to 'miniorange_oauth_client_customer_setup'
miniorange_oauth_client_menu in ./miniorange_oauth_client.module
Implements hook_menu().

File

./miniorange_oauth_client_customer_setup.inc, line 9

Code

function miniorange_oauth_client_customer_setup($form, &$form_state) {
  drupal_add_css(drupal_get_path('module', 'miniorange_oauth_client') . '/css/bootstrap.min.css', array(
    'group' => CSS_DEFAULT,
    'every_page' => FALSE,
  ));
  drupal_add_css(drupal_get_path('module', 'miniorange_oauth_client') . '/css/style_settings.css', array(
    'group' => CSS_DEFAULT,
    'every_page' => FALSE,
  ));
  drupal_add_js(drupal_get_path('module', 'miniorange_oauth_client') . '/js/slide_support_button.js');
  $current_status = variable_get('miniorange_oauth_client_status', '');
  if ($current_status == 'VALIDATE_OTP') {
    $form['mo_header_style'] = array(
      '#markup' => '<div class="mo_oauth_table_layout_1">',
    );
    $form['mo_top_div'] = array(
      '#markup' => '<div class="mo_oauth_table_layout mo_oauth_container">',
    );
    $form['miniorange_oauth_client_customer_otp_token'] = array(
      '#type' => 'textfield',
      '#title' => t('OTP'),
      '#attributes' => array(
        'style' => 'width:30%;',
      ),
    );
    $form['miniorange_oauth_client_customer_validate_otp_button'] = array(
      '#type' => 'submit',
      '#value' => t('Validate OTP'),
      '#submit' => array(
        'miniorange_oauth_client_validate_otp_submit',
      ),
      '#id' => 'button_config',
    );
    $form['miniorange_oauth_client_customer_setup_resendotp'] = array(
      '#type' => 'submit',
      '#value' => t('Resend OTP'),
      '#submit' => array(
        'miniorange_oauth_client_resend_otp',
      ),
      '#id' => 'button_config',
    );
    $form['miniorange_oauth_client_customer_setup_back'] = array(
      '#type' => 'submit',
      '#value' => t('Back'),
      '#submit' => array(
        'miniorange_oauth_client_back',
      ),
      '#id' => 'button_config',
    );
    $form['mo_header_style_end'] = array(
      '#markup' => '</div>',
    );
    Utilities::nofeaturelisted($form, $form_state);
    Utilities::AddSupportButton($form, $form_state);
    return $form;
  }
  elseif ($current_status == 'PLUGIN_CONFIGURATION') {

    // Show customer configuration here.
    $form['mo_header_style'] = array(
      '#markup' => '<div class="mo_oauth_table_layout_1">',
    );
    $form['mo_top_div'] = array(
      '#markup' => '<div class="mo_oauth_table_layout mo_oauth_container">',
    );
    $form['markup_top'] = array(
      '#markup' => '<div style="display:block;margin-top:10px;text-align: center;font-size: 15px;color:rgba(0, 128, 0, 0.80);background-color:rgba(0, 255, 0, 0.15);padding:5px;">
                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_oauth_client_customer_admin_email', ''),
      'customerid' => variable_get('miniorange_oauth_client_customer_id', ''),
      'token' => variable_get('miniorange_oauth_client_customer_admin_token', ''),
      'apikey' => variable_get('miniorange_oauth_client_customer_api_key', ''),
    );
    $form['fieldset']['customerinfo'] = array(
      '#theme' => 'table',
      '#header' => $header,
      '#rows' => $options,
    );
    $form['mo_header_style_end'] = array(
      '#markup' => '<br><br><br><br><br></div>',
    );
    Utilities::nofeaturelisted($form, $form_state);
    Utilities::AddSupportButton($form, $form_state);
    return $form;
  }
  $form['mo_header_style'] = array(
    '#markup' => '<div class="mo_oauth_table_layout_1">',
  );
  $form['mo_top_div'] = array(
    '#markup' => '<div class="mo_oauth_table_layout mo_oauth_container">',
  );
  $form['markup_1'] = array(
    '#markup' => '<h3>Register/Login with miniOrange</h3>',
    '#suffix' => '<hr><br>',
  );
  $form['markup_2'] = array(
    '#markup' => '<div class="mo_oauth_highlight_background_note_export"><p><h3>Why Should I register?</h3></p>
           <b>You will be needing a miniOrange account to upgrade to the Standard, Premium or Enterprise versions of the modules.</b><br>
             If you are facing any issues with registering from module, you can click <a href="https://www.miniorange.com/businessfreetrial" target="_blank"> here</a> to register. Please use the same credentials to login in the module.<br>
             We do not store any information except the email that you will use to register with us.<br>
             </div>',
  );
  $form['miniorange_oauth_client_customer_setup_username'] = array(
    '#type' => 'textfield',
    '#title' => t('Email'),
    '#prefix' => '<br>',
    '#attributes' => array(
      'style' => 'width:50%;',
      'placeholder' => 'Enter your email',
    ),
  );
  $form['miniorange_oauth_client_customer_setup_phone'] = array(
    '#type' => 'textfield',
    '#title' => t('Phone'),
    '#description' => '<b>NOTE:</b> We will only call if you need support.',
    '#attributes' => array(
      'style' => 'width:50%;',
    ),
  );
  $form['miniorange_oauth_client_customer_setup_password'] = array(
    '#type' => 'password_confirm',
  );
  $form['miniorange_oauth_client_customer_setup_button'] = array(
    '#type' => 'submit',
    '#value' => t('Submit'),
    '#id' => 'button_config',
    '#submit' => array(
      'miniorange_oauth_client_customer_setup_submit',
    ),
  );
  $form['markup_divEnd'] = array(
    '#markup' => '</div>',
  );
  Utilities::nofeaturelisted($form, $form_state);
  Utilities::AddSupportButton($form, $form_state);
  return $form;
}