You are here

function mo_auth_configure_otp_over_sms_and_email in Google Authenticator / 2 Factor Authentication - 2FA 7

1 string reference to 'mo_auth_configure_otp_over_sms_and_email'
mo_auth_menu in ./mo_auth.module
Implements hook_menu().

File

./configure_otp_over_sms_and_email.inc, line 3

Code

function mo_auth_configure_otp_over_sms_and_email($form, &$form_state) {
  drupal_add_js(drupal_get_path('module', 'mo_auth') . '/includes/js/Phone.js', 'file');
  drupal_add_css(drupal_get_path('module', 'mo_auth') . '/includes/css/phone.css', array(
    'group' => CSS_DEFAULT,
    'every_page' => FALSE,
  ));
  global $base_url, $user;
  $user = user_load($user->uid);
  $user_email = $user->miniorange_registered_email[LANGUAGE_NONE][0]['value'];
  $customer = new MiniorangeCustomerProfile();
  $miniorange_user = new MiniorangeUser($customer
    ->getCustomerID(), $user_email, NULL, NULL, AuthenticationType::$SMS_AND_EMAIL['code']);
  $auth_api_handler = new AuthenticationAPIHandler($customer
    ->getCustomerID(), $customer
    ->getAPIKey());
  $mo_note = t('<ul><li>Customize Email template.</li><li>Customize SMS template.</li> <li>Customize OTP Length and Validity.</li><li>For customization goto <a href="' . $base_url . '/admin/config/people/mo_auth/login_settings">Login Settings</a> tab and navigate to <u>CUSTOMIZE SMS AND EMAIL TEMPLATE</u> section.</li></ul>');
  $form['header']['#markup'] = '<div class="mo2f-setup-header"><div class="mo2f-setup-header-top-left">Configure OTP Over SMS And Email</div></div>';
  $form['mo_2fa_custom_note'] = array(
    '#markup' => t('<br><hr><br><div class="mo2f_highlight_background_note"><strong>You can customize the following things of the OTP OVER SMS AND EMAIL method:</strong>' . $mo_note . '</div><br>'),
  );
  $form['miniorange_phone'] = array(
    '#type' => 'textfield',
    '#title' => t('Verify Your Phone'),
    '#id' => 'query_phone',
    '#attributes' => array(
      'class' => array(
        'query_phone',
      ),
      'pattern' => '[\\+][0-9]{1,4}\\s?[0-9]{7,12}',
    ),
    '#description' => t('Enter your phone number with country code (+1)'),
  );
  $form['miniorange_email'] = array(
    '#type' => 'textfield',
    '#value' => $user_email,
    '#disabled' => TRUE,
  );
  $form['verifyphone'] = array(
    '#type' => 'submit',
    '#value' => t('Verify'),
    '#submit' => array(
      'mo_auth_configure_otp_over_sms_and_email_submit',
    ),
  );
  $form['miniorange_saml_customer_setup_resendotp'] = array(
    '#type' => 'submit',
    '#value' => t('Resend OTP'),
    '#submit' => array(
      'miniorange_saml_resend_otp',
    ),
  );
  $form['miniorange_OTP'] = array(
    '#type' => 'textfield',
    '#title' => t('OTP'),
  );
  $form['miniorange_saml_customer_validate_otp_button'] = array(
    '#type' => 'submit',
    '#value' => t('Validate OTP'),
    '#submit' => array(
      'miniorange_saml_validate_otp_submit',
    ),
  );
  $form['actions']['cancel'] = array(
    '#markup' => l(t('Back'), 'admin/config/people/mo_auth/setup'),
  );
  return $form;
}